{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    " <div align='center'><font size='6.5'>高德API_week08</font></div>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 高德API_week08作业  \n",
    "\n",
    "### 要求：  \n",
    "\n",
    "- 1、所有的高德API功能（除去地理围栏、轨迹纠偏）；  \n",
    "\n",
    "- 2、每一个API功能请思考和设计该功能的一个具体的产品应用方案或场景，写在每一个markdown中；  \n",
    "\n",
    "- 3、所有的功能一定要用函数封装，且所有参数（必选参数 + 可选参数 <默认参数None/？>）应该写在定义函数之中；  \n",
    "\n",
    "- 4、高德API在jupyter中全部测试完成无误，将其保存为一个geo.py文件（模块）；  \n",
    "\n",
    "- 5、PEP8规范书写python代码；  \n",
    "\n",
    "- 6、其它：尝试自己调用这个模块 from geo import geocode / import geo  \n",
    "（额外）尝试发放到pypi上面  \n",
    "\n",
    "### 提交内容：  \n",
    "\n",
    "- 1、上传到GitHub / Gitee ①.geo_name.ipynb ②.geo.py"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 准备工作\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 准备工作部分，导入需要的模块，并输入key值\n",
    "import requests,json\n",
    "import pandas as pd\n",
    "key = \"54ff0cd3dfc0209e54bb7b5aec47605b\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 地理编码\n",
    "\n",
    "* 1、地理编码的作用：将详细的结构化地址转换为高德经纬度坐标。且支持对地标性名胜景区、建筑物名称解析为高德经纬度坐标。  \n",
    "\n",
    "* 2、URL：https://restapi.amap.com/v3/geocode/geo?parameters  \n",
    "\n",
    "* 3、请求方式：requests.get()  \n",
    "\n",
    "* 4、请求参数（parameters）：\n",
    "> * ①.必选：key（高德API密钥）、address（结构化地址）\n",
    "> * ②.可选：city（指定查询城市）、output（返回数据格式类型：json）"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 地理编码运用（个人见解）\n",
    "> 地理编码是基于空间定位技术的一种编码方法,它提供了一种把描述成地址的地理位置信息转换成可以被用于GIS系统的地理坐标的方式。在我看来，地理编码技术可以**以地址数据作为基础纽带，将各市政府、部门分散的信息资源库之间建立有机的联系**。构建地区之间信息的框架，实时共享数据，为**数字城市建设**出一份力。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'count': '1',\n",
       " 'geocodes': [{'formatted_address': '广东省广州市从化区中山大学南方学院',\n",
       "   'country': '中国',\n",
       "   'province': '广东省',\n",
       "   'citycode': '020',\n",
       "   'city': '广州市',\n",
       "   'district': '从化区',\n",
       "   'township': [],\n",
       "   'neighborhood': {'name': [], 'type': []},\n",
       "   'building': {'name': [], 'type': []},\n",
       "   'adcode': '440117',\n",
       "   'street': [],\n",
       "   'number': [],\n",
       "   'location': '113.679287,23.632575',\n",
       "   'level': '兴趣点'}]}"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 准备工作 导入地理编码函数模块（获取中山大学南方学院的地理编码）\n",
    "from geo import geocode\n",
    "中大南方_geo = geocode(key,\"广东省广州市中山大学南方学院\")\n",
    "中大南方_geo"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'113.679287,23.632575'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 取值地理编码\n",
    "中大南方_geo['geocodes'][0]['location']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 逆地理编码\n",
    "\n",
    "* 1、逆地理编码的作用：将经纬度转换为详细结构化的地址，且返回附近周边的POI、AOI信息。  \n",
    "\n",
    "* 2、URL：https://restapi.amap.com/v3/geocode/regeo?parameters  \n",
    "\n",
    "* 3、请求方式：requests.get()  \n",
    "\n",
    "* 4、请求参数（parameters）：\n",
    "> * ①.必选：key（高德API密钥）、location（**经纬度坐标**）\n",
    "> * ②.可选：poitype（返回附近POI类型）、radius（指定查询城市）、extensions（返回结果控制<默认值：base、可选：all>）、batch（批量查询控制：ture、false）、roadlevel（道路等级：0 1）、sig（数字签名）、callback（回调函数）、output（返回数据格式类型：json）、homeorcorp（是否优化POI返回顺序：0 1 2）"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 逆地理编码应用（个人见解）\n",
    "> 逆地理编码的应用，在自己制作网页的过程中，我们可以利用逆地理编码，通过输入经纬度或者鼠标点击地图，获取该位置的地址信息，图标标注并自动弹窗，弹窗内容为地址信息。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'regeocode': {'addressComponent': {'city': '广州市',\n",
       "   'province': '广东省',\n",
       "   'adcode': '440117',\n",
       "   'district': '从化区',\n",
       "   'towncode': '440117103000',\n",
       "   'streetNumber': {'number': '7号',\n",
       "    'location': '113.678600,23.633329',\n",
       "    'direction': '西北',\n",
       "    'distance': '109.203',\n",
       "    'street': '博学路'},\n",
       "   'country': '中国',\n",
       "   'township': '温泉镇',\n",
       "   'businessAreas': [[]],\n",
       "   'building': {'name': [], 'type': []},\n",
       "   'neighborhood': {'name': [], 'type': []},\n",
       "   'citycode': '020'},\n",
       "  'formatted_address': '广东省广州市从化区温泉镇中山大学南方学院'},\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000'}"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from geo import re_geocode\n",
    "中大南方_re = re_geocode(key,中大南方_location)\n",
    "中大南方_re"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'广东省广州市从化区温泉镇中山大学南方学院'"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 取值逆地理编码\n",
    "中大南方_re['regeocode']['formatted_address']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 路径规划\n",
    "\n",
    "* 1、以HTTP形式提供的步行、公交、驾车查询及行驶距离计算接口，返回JSON 或 XML格式的查询数据。  \n",
    "\n",
    "* 2、URL：（具体见下方）  \n",
    "\n",
    "* 3、请求方式：requests.get()  \n",
    "\n",
    "* 4、请求参数（parameters）：\n",
    "> * ①.必选：（具体见下方）\n",
    "> * ②.可选：（具体见下方）"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 路径规划应用（个人见解）\n",
    "> 路径规划的功能强大，我们可能应用在很多的场景，规划步行、公交、驾车、骑行、货车出行的路径，且内容详细，方案众多可供选择性强，实用性强。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 路径规划函数写法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "113.679287,23.632575\n",
      "113.668051,23.600869\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'ok',\n",
       " 'infocode': '10000',\n",
       " 'count': '1',\n",
       " 'route': {'origin': '113.679287,23.632575',\n",
       "  'destination': '113.668051,23.600869',\n",
       "  'paths': [{'distance': '4957',\n",
       "    'duration': '3966',\n",
       "    'steps': [{'instruction': '向东步行101米右转',\n",
       "      'orientation': '东',\n",
       "      'road': [],\n",
       "      'distance': '101',\n",
       "      'duration': '81',\n",
       "      'polyline': '113.679592,23.632491;113.680586,23.632522',\n",
       "      'action': '右转',\n",
       "      'assistant_action': [],\n",
       "      'walk_type': '0'},\n",
       "     {'instruction': '向南步行199米向右前方行走',\n",
       "      'orientation': '南',\n",
       "      'road': [],\n",
       "      'distance': '199',\n",
       "      'duration': '159',\n",
       "      'polyline': '113.680586,23.632522;113.680638,23.63214;113.680668,23.63174;113.680634,23.631541;113.68059,23.631437;113.68059,23.631437;113.680499,23.631241;113.680408,23.631094;113.680208,23.630842',\n",
       "      'action': '向右前方行走',\n",
       "      'assistant_action': [],\n",
       "      'walk_type': '0'},\n",
       "     {'instruction': '向西步行159米左转',\n",
       "      'orientation': '西',\n",
       "      'road': [],\n",
       "      'distance': '159',\n",
       "      'duration': '127',\n",
       "      'polyline': '113.680204,23.630838;113.680035,23.630773;113.680035,23.630773;113.679644,23.630638;113.679644,23.630638;113.679362,23.630521;113.679201,23.630473;113.679201,23.630473;113.679032,23.63043;113.679032,23.63043;113.67888,23.630404;113.67888,23.630404;113.678711,23.630365',\n",
       "      'action': '左转',\n",
       "      'assistant_action': [],\n",
       "      'walk_type': '0'},\n",
       "     {'instruction': '向南步行237米左转',\n",
       "      'orientation': '南',\n",
       "      'road': [],\n",
       "      'distance': '237',\n",
       "      'duration': '190',\n",
       "      'polyline': '113.678711,23.63036;113.678711,23.62934;113.678711,23.62934;113.678711,23.629193;113.678689,23.629084;113.678637,23.629023;113.678424,23.628902;113.678368,23.628841;113.678316,23.628724;113.678294,23.628611;113.678294,23.628611;113.678277,23.628372',\n",
       "      'action': '左转',\n",
       "      'assistant_action': [],\n",
       "      'walk_type': '0'},\n",
       "     {'instruction': '向南步行498米向右前方行走',\n",
       "      'orientation': '南',\n",
       "      'road': [],\n",
       "      'distance': '498',\n",
       "      'duration': '398',\n",
       "      'polyline': '113.678273,23.628368;113.678572,23.628338;113.678685,23.628307;113.678685,23.628307;113.678845,23.628234;113.679045,23.628073;113.679158,23.627964;113.679158,23.627964;113.679214,23.627869;113.679236,23.627778;113.67928,23.627526;113.679288,23.627322;113.679288,23.627322;113.679253,23.626853;113.679184,23.626623;113.679141,23.626497;113.679002,23.626259;113.678941,23.626176;113.678711,23.625977;113.67862,23.625864;113.678529,23.62572;113.678438,23.625191;113.678429,23.625056;113.678451,23.624939;113.678572,23.624657',\n",
       "      'action': '向右前方行走',\n",
       "      'assistant_action': [],\n",
       "      'walk_type': '0'},\n",
       "     {'instruction': '向西南步行722米左转',\n",
       "      'orientation': '西南',\n",
       "      'road': [],\n",
       "      'distance': '722',\n",
       "      'duration': '578',\n",
       "      'polyline': '113.678572,23.624653;113.678559,23.62451;113.678416,23.624323;113.678416,23.624323;113.677582,23.623793;113.676532,23.623346;113.676363,23.623255;113.676272,23.623151;113.676111,23.622834;113.676042,23.622739;113.67579,23.622483;113.675499,23.622279;113.675417,23.622174;113.675386,23.622088;113.675378,23.621836;113.675378,23.621836;113.675391,23.62161;113.675434,23.621476;113.675543,23.621359;113.675764,23.621181;113.675846,23.621089;113.675903,23.620994;113.675907,23.620855;113.675877,23.620725;113.675747,23.620547;113.675599,23.620373;113.675243,23.620013',\n",
       "      'action': '左转',\n",
       "      'assistant_action': [],\n",
       "      'walk_type': '0'},\n",
       "     {'instruction': '向东南步行412米向右前方行走',\n",
       "      'orientation': '东南',\n",
       "      'road': [],\n",
       "      'distance': '412',\n",
       "      'duration': '330',\n",
       "      'polyline': '113.675239,23.620009;113.67549,23.620013;113.675642,23.619991;113.675773,23.619948;113.676016,23.619796;113.676901,23.619193;113.677261,23.618785;113.678069,23.61783;113.678069,23.61783;113.678181,23.617656',\n",
       "      'action': '向右前方行走',\n",
       "      'assistant_action': [],\n",
       "      'walk_type': '0'},\n",
       "     {'instruction': '沿乌土街向南步行1381米右转',\n",
       "      'orientation': '南',\n",
       "      'road': '乌土街',\n",
       "      'distance': '1381',\n",
       "      'duration': '1105',\n",
       "      'polyline': '113.678181,23.617652;113.678095,23.617205;113.678051,23.617075;113.677973,23.616923;113.677743,23.616558;113.677609,23.616289;113.677391,23.615816;113.677339,23.615668;113.67714,23.614826;113.677049,23.614323;113.676927,23.613359;113.676845,23.612786;113.676602,23.611489;113.676415,23.610438;113.676411,23.610265;113.676411,23.610265;113.676489,23.609848;113.676502,23.609622;113.676493,23.609236;113.676415,23.608746;113.676415,23.608485;113.67648,23.60819;113.67661,23.607734;113.676819,23.606736;113.676862,23.606541;113.676914,23.606415;113.677014,23.606254;113.677535,23.605673',\n",
       "      'action': '右转',\n",
       "      'assistant_action': [],\n",
       "      'walk_type': '0'},\n",
       "     {'instruction': '沿乌土街向西南步行165米直行',\n",
       "      'orientation': '西南',\n",
       "      'road': '乌土街',\n",
       "      'distance': '165',\n",
       "      'duration': '132',\n",
       "      'polyline': '113.677535,23.605668;113.676988,23.605373;113.676402,23.605;113.676163,23.604887',\n",
       "      'action': '直行',\n",
       "      'assistant_action': [],\n",
       "      'walk_type': '0'},\n",
       "     {'instruction': '沿934县道向西步行118米直行',\n",
       "      'orientation': '西',\n",
       "      'road': '934县道',\n",
       "      'distance': '118',\n",
       "      'duration': '94',\n",
       "      'polyline': '113.676159,23.604883;113.675799,23.604805;113.675508,23.604779;113.675508,23.604779;113.675013,23.60474',\n",
       "      'action': '直行',\n",
       "      'assistant_action': [],\n",
       "      'walk_type': '0'},\n",
       "     {'instruction': '沿桃园东路向西南步行674米向右前方行走',\n",
       "      'orientation': '西南',\n",
       "      'road': '桃园东路',\n",
       "      'distance': '674',\n",
       "      'duration': '539',\n",
       "      'polyline': '113.675009,23.604735;113.674236,23.604683;113.673893,23.604618;113.673464,23.604492;113.673464,23.604492;113.67168,23.604006;113.671541,23.603958;113.671411,23.603854;113.671068,23.603472;113.670807,23.603264;113.670807,23.603264;113.670525,23.603073;113.6702,23.602904;113.6702,23.602904;113.670022,23.602795;113.670022,23.602795;113.669909,23.602682;113.669818,23.602517;113.669787,23.602413;113.669718,23.601901',\n",
       "      'action': '向右前方行走',\n",
       "      'assistant_action': [],\n",
       "      'walk_type': '0'},\n",
       "     {'instruction': '沿桃园东路向西南步行247米右转',\n",
       "      'orientation': '西南',\n",
       "      'road': '桃园东路',\n",
       "      'distance': '247',\n",
       "      'duration': '198',\n",
       "      'polyline': '113.669714,23.601897;113.66964,23.601771;113.66964,23.601771;113.669488,23.601558;113.669488,23.601558;113.668789,23.600859;113.668663,23.600768;113.668663,23.600768;113.668442,23.600647;113.667947,23.600417',\n",
       "      'action': '右转',\n",
       "      'assistant_action': [],\n",
       "      'walk_type': '0'},\n",
       "     {'instruction': '沿龙泉路向北步行44米到达目的地',\n",
       "      'orientation': '北',\n",
       "      'road': '龙泉路',\n",
       "      'distance': '44',\n",
       "      'duration': '35',\n",
       "      'polyline': '113.667943,23.600412;113.667812,23.600794',\n",
       "      'action': [],\n",
       "      'assistant_action': '到达目的地',\n",
       "      'walk_type': '0'}]}]}}"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 调用地理编码的函数获取出发点的地理编码\n",
    "origin = \"广东省广州市中山大学南方学院\"\n",
    "中大南方_origin = geocode(key,origin)\n",
    "中大南方_origin['geocodes'][0]['location']\n",
    "print(中大南方_origin['geocodes'][0]['location'])\n",
    "\n",
    "# 调用地理编码的函数获取目的地的地理编码\n",
    "destination = \"广东省广州市从化区龙岗\"\n",
    "龙岗_destination = geocode(key,destination)\n",
    "龙岗_destination['geocodes'][0]['location']\n",
    "print(龙岗_destination['geocodes'][0]['location'])\n",
    "\n",
    "# 调用步行规划路径的函数\n",
    "路径_plan = walking(key,中大南方_origin['geocodes'][0]['location'],龙岗_destination['geocodes'][0]['location'])\n",
    "路径_plan"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'distance': '4957',\n",
       "  'duration': '3966',\n",
       "  'steps': [{'instruction': '向东步行101米右转',\n",
       "    'orientation': '东',\n",
       "    'road': [],\n",
       "    'distance': '101',\n",
       "    'duration': '81',\n",
       "    'polyline': '113.679592,23.632491;113.680586,23.632522',\n",
       "    'action': '右转',\n",
       "    'assistant_action': [],\n",
       "    'walk_type': '0'},\n",
       "   {'instruction': '向南步行199米向右前方行走',\n",
       "    'orientation': '南',\n",
       "    'road': [],\n",
       "    'distance': '199',\n",
       "    'duration': '159',\n",
       "    'polyline': '113.680586,23.632522;113.680638,23.63214;113.680668,23.63174;113.680634,23.631541;113.68059,23.631437;113.68059,23.631437;113.680499,23.631241;113.680408,23.631094;113.680208,23.630842',\n",
       "    'action': '向右前方行走',\n",
       "    'assistant_action': [],\n",
       "    'walk_type': '0'},\n",
       "   {'instruction': '向西步行159米左转',\n",
       "    'orientation': '西',\n",
       "    'road': [],\n",
       "    'distance': '159',\n",
       "    'duration': '127',\n",
       "    'polyline': '113.680204,23.630838;113.680035,23.630773;113.680035,23.630773;113.679644,23.630638;113.679644,23.630638;113.679362,23.630521;113.679201,23.630473;113.679201,23.630473;113.679032,23.63043;113.679032,23.63043;113.67888,23.630404;113.67888,23.630404;113.678711,23.630365',\n",
       "    'action': '左转',\n",
       "    'assistant_action': [],\n",
       "    'walk_type': '0'},\n",
       "   {'instruction': '向南步行237米左转',\n",
       "    'orientation': '南',\n",
       "    'road': [],\n",
       "    'distance': '237',\n",
       "    'duration': '190',\n",
       "    'polyline': '113.678711,23.63036;113.678711,23.62934;113.678711,23.62934;113.678711,23.629193;113.678689,23.629084;113.678637,23.629023;113.678424,23.628902;113.678368,23.628841;113.678316,23.628724;113.678294,23.628611;113.678294,23.628611;113.678277,23.628372',\n",
       "    'action': '左转',\n",
       "    'assistant_action': [],\n",
       "    'walk_type': '0'},\n",
       "   {'instruction': '向南步行498米向右前方行走',\n",
       "    'orientation': '南',\n",
       "    'road': [],\n",
       "    'distance': '498',\n",
       "    'duration': '398',\n",
       "    'polyline': '113.678273,23.628368;113.678572,23.628338;113.678685,23.628307;113.678685,23.628307;113.678845,23.628234;113.679045,23.628073;113.679158,23.627964;113.679158,23.627964;113.679214,23.627869;113.679236,23.627778;113.67928,23.627526;113.679288,23.627322;113.679288,23.627322;113.679253,23.626853;113.679184,23.626623;113.679141,23.626497;113.679002,23.626259;113.678941,23.626176;113.678711,23.625977;113.67862,23.625864;113.678529,23.62572;113.678438,23.625191;113.678429,23.625056;113.678451,23.624939;113.678572,23.624657',\n",
       "    'action': '向右前方行走',\n",
       "    'assistant_action': [],\n",
       "    'walk_type': '0'},\n",
       "   {'instruction': '向西南步行722米左转',\n",
       "    'orientation': '西南',\n",
       "    'road': [],\n",
       "    'distance': '722',\n",
       "    'duration': '578',\n",
       "    'polyline': '113.678572,23.624653;113.678559,23.62451;113.678416,23.624323;113.678416,23.624323;113.677582,23.623793;113.676532,23.623346;113.676363,23.623255;113.676272,23.623151;113.676111,23.622834;113.676042,23.622739;113.67579,23.622483;113.675499,23.622279;113.675417,23.622174;113.675386,23.622088;113.675378,23.621836;113.675378,23.621836;113.675391,23.62161;113.675434,23.621476;113.675543,23.621359;113.675764,23.621181;113.675846,23.621089;113.675903,23.620994;113.675907,23.620855;113.675877,23.620725;113.675747,23.620547;113.675599,23.620373;113.675243,23.620013',\n",
       "    'action': '左转',\n",
       "    'assistant_action': [],\n",
       "    'walk_type': '0'},\n",
       "   {'instruction': '向东南步行412米向右前方行走',\n",
       "    'orientation': '东南',\n",
       "    'road': [],\n",
       "    'distance': '412',\n",
       "    'duration': '330',\n",
       "    'polyline': '113.675239,23.620009;113.67549,23.620013;113.675642,23.619991;113.675773,23.619948;113.676016,23.619796;113.676901,23.619193;113.677261,23.618785;113.678069,23.61783;113.678069,23.61783;113.678181,23.617656',\n",
       "    'action': '向右前方行走',\n",
       "    'assistant_action': [],\n",
       "    'walk_type': '0'},\n",
       "   {'instruction': '沿乌土街向南步行1381米右转',\n",
       "    'orientation': '南',\n",
       "    'road': '乌土街',\n",
       "    'distance': '1381',\n",
       "    'duration': '1105',\n",
       "    'polyline': '113.678181,23.617652;113.678095,23.617205;113.678051,23.617075;113.677973,23.616923;113.677743,23.616558;113.677609,23.616289;113.677391,23.615816;113.677339,23.615668;113.67714,23.614826;113.677049,23.614323;113.676927,23.613359;113.676845,23.612786;113.676602,23.611489;113.676415,23.610438;113.676411,23.610265;113.676411,23.610265;113.676489,23.609848;113.676502,23.609622;113.676493,23.609236;113.676415,23.608746;113.676415,23.608485;113.67648,23.60819;113.67661,23.607734;113.676819,23.606736;113.676862,23.606541;113.676914,23.606415;113.677014,23.606254;113.677535,23.605673',\n",
       "    'action': '右转',\n",
       "    'assistant_action': [],\n",
       "    'walk_type': '0'},\n",
       "   {'instruction': '沿乌土街向西南步行165米直行',\n",
       "    'orientation': '西南',\n",
       "    'road': '乌土街',\n",
       "    'distance': '165',\n",
       "    'duration': '132',\n",
       "    'polyline': '113.677535,23.605668;113.676988,23.605373;113.676402,23.605;113.676163,23.604887',\n",
       "    'action': '直行',\n",
       "    'assistant_action': [],\n",
       "    'walk_type': '0'},\n",
       "   {'instruction': '沿934县道向西步行118米直行',\n",
       "    'orientation': '西',\n",
       "    'road': '934县道',\n",
       "    'distance': '118',\n",
       "    'duration': '94',\n",
       "    'polyline': '113.676159,23.604883;113.675799,23.604805;113.675508,23.604779;113.675508,23.604779;113.675013,23.60474',\n",
       "    'action': '直行',\n",
       "    'assistant_action': [],\n",
       "    'walk_type': '0'},\n",
       "   {'instruction': '沿桃园东路向西南步行674米向右前方行走',\n",
       "    'orientation': '西南',\n",
       "    'road': '桃园东路',\n",
       "    'distance': '674',\n",
       "    'duration': '539',\n",
       "    'polyline': '113.675009,23.604735;113.674236,23.604683;113.673893,23.604618;113.673464,23.604492;113.673464,23.604492;113.67168,23.604006;113.671541,23.603958;113.671411,23.603854;113.671068,23.603472;113.670807,23.603264;113.670807,23.603264;113.670525,23.603073;113.6702,23.602904;113.6702,23.602904;113.670022,23.602795;113.670022,23.602795;113.669909,23.602682;113.669818,23.602517;113.669787,23.602413;113.669718,23.601901',\n",
       "    'action': '向右前方行走',\n",
       "    'assistant_action': [],\n",
       "    'walk_type': '0'},\n",
       "   {'instruction': '沿桃园东路向西南步行247米右转',\n",
       "    'orientation': '西南',\n",
       "    'road': '桃园东路',\n",
       "    'distance': '247',\n",
       "    'duration': '198',\n",
       "    'polyline': '113.669714,23.601897;113.66964,23.601771;113.66964,23.601771;113.669488,23.601558;113.669488,23.601558;113.668789,23.600859;113.668663,23.600768;113.668663,23.600768;113.668442,23.600647;113.667947,23.600417',\n",
       "    'action': '右转',\n",
       "    'assistant_action': [],\n",
       "    'walk_type': '0'},\n",
       "   {'instruction': '沿龙泉路向北步行44米到达目的地',\n",
       "    'orientation': '北',\n",
       "    'road': '龙泉路',\n",
       "    'distance': '44',\n",
       "    'duration': '35',\n",
       "    'polyline': '113.667943,23.600412;113.667812,23.600794',\n",
       "    'action': [],\n",
       "    'assistant_action': '到达目的地',\n",
       "    'walk_type': '0'}]}]"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "路径_plan['route']['paths']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 公交路径\n",
    "* 1、规划综合各类公共（火车、公交、地铁）交通方式的通勤方案，并且返回通勤方案的数据。  \n",
    "\n",
    "* 2、URL：https://restapi.amap.com/v3/direction/transit/integrated?parameters  \n",
    "\n",
    "* 3、请求方式：requests.get()  \n",
    "\n",
    "* 4、请求参数（parameters）：\n",
    "> * ①.必选：key（高德API密钥）、origin（出发点：**经纬度**）、destination（目的地：**经纬度**）、city（城市）\n",
    "> * ②.可选：cityd（跨城公交规划时的重点城市）、extensions（返回结果详略：base / all）、strategy（公交换乘策略：0 1 2 3 5）、nightflag（是否计算夜班车：0<不计算夜班车> 1<计算夜班车>）、date（出发日期）、time（出发时间）、sig（数字签名）、callback（回调函数）、output（返回数据格式类型：json）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 调用geo.py文件中的bus和geocode模块\n",
    "from geo import bus,geocode"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "113.679287,23.632575\n",
      "113.668051,23.600869\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'count': '5',\n",
       " 'route': {'origin': '113.679287,23.632575',\n",
       "  'destination': '113.668051,23.600869',\n",
       "  'distance': '4273',\n",
       "  'taxi_cost': '17',\n",
       "  'transits': [{'cost': [],\n",
       "    'duration': '4581',\n",
       "    'nightflag': '0',\n",
       "    'walking_distance': '637',\n",
       "    'distance': '24039',\n",
       "    'missed': '1',\n",
       "    'segments': [{'taxi': [],\n",
       "      'walking': {'origin': '113.679016,23.632349',\n",
       "       'destination': '113.676613,23.631285',\n",
       "       'distance': '513',\n",
       "       'duration': '439',\n",
       "       'steps': [{'instruction': '步行57米右转',\n",
       "         'road': [],\n",
       "         'distance': '57',\n",
       "         'duration': [],\n",
       "         'polyline': '113.679016,23.632349;113.678528,23.632097',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行47米向左前方行走',\n",
       "         'road': [],\n",
       "         'distance': '47',\n",
       "         'duration': [],\n",
       "         'polyline': '113.678528,23.632092;113.678398,23.632166;113.678101,23.632261',\n",
       "         'action': '向左前方行走',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行218米左转',\n",
       "         'road': [],\n",
       "         'distance': '218',\n",
       "         'duration': [],\n",
       "         'polyline': '113.678101,23.632261;113.677834,23.632261;113.677551,23.632200;113.677399,23.632179;113.677284,23.632200;113.677177,23.632244;113.677017,23.632357;113.676811,23.632534;113.676582,23.632778;113.676430,23.632904;113.676292,23.632969',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿博学路步行191米到达中大南方学院',\n",
       "         'road': '博学路',\n",
       "         'distance': '191',\n",
       "         'duration': [],\n",
       "         'polyline': '113.676285,23.632969;113.676292,23.632227;113.676338,23.631948;113.676430,23.631676;113.676491,23.631540;113.676613,23.631285',\n",
       "         'action': [],\n",
       "         'assistant_action': '到达中大南方学院'}]},\n",
       "      'bus': {'buslines': [{'departure_stop': {'name': '中大南方学院',\n",
       "          'id': '900000111141002',\n",
       "          'location': '113.676613,23.631281'},\n",
       "         'arrival_stop': {'name': '沙塱村',\n",
       "          'id': '900000111141015',\n",
       "          'location': '113.615547,23.557409'},\n",
       "         'name': '从15路(中大南方学院--从化汽车站总站)',\n",
       "         'id': '900000111141',\n",
       "         'type': '普通公交线路',\n",
       "         'distance': '15234',\n",
       "         'duration': '2634',\n",
       "         'polyline': '113.676613,23.631281;113.676460,23.631588;113.676430,23.631672;113.676338,23.631945;113.676292,23.632223;113.676285,23.632969;113.676285,23.633560;113.676300,23.633738;113.676331,23.633875;113.676399,23.634016;113.676460,23.634111;113.676521,23.634193;113.676781,23.634409;113.676857,23.634357;113.676933,23.634340;113.677032,23.634354;113.677094,23.634396;113.677139,23.634459;113.677147,23.634535;113.677139,23.634600;113.677086,23.634663;113.677032,23.634701;113.676918,23.634718;113.676857,23.634701;113.676788,23.634657;113.675262,23.636129;113.675156,23.636263;113.675026,23.636467;113.674973,23.636566;113.674957,23.636702;113.674957,23.636845;113.674995,23.636995;113.675377,23.637886;113.675430,23.638042;113.675522,23.638659;113.675529,23.638998;113.675514,23.639132;113.675446,23.639311;113.675331,23.639582;113.675102,23.640036;113.675003,23.640186;113.674309,23.641024;113.673347,23.642139;113.672981,23.642536;113.672935,23.642578;113.672173,23.643307;113.671707,23.643766;113.671432,23.644045;113.673103,23.644968;113.674362,23.645651;113.675461,23.646276;113.675964,23.646635;113.676407,23.647018;113.676376,23.647089;113.675964,23.646744;113.675735,23.646566;113.675468,23.646385;113.675095,23.646172;113.673004,23.645004;113.669968,23.643330;113.669167,23.642881;113.668770,23.642673;113.668594,23.642578;113.667007,23.641693;113.666145,23.641171;113.665314,23.640564;113.665253,23.640511;113.665016,23.640301;113.664772,23.640064;113.664551,23.639812;113.664406,23.639662;113.664207,23.639400;113.663925,23.639021;113.663574,23.638451;113.663361,23.638020;113.662323,23.635933;113.661949,23.635181;113.661461,23.634266;113.661224,23.633898;113.660843,23.633383;113.660683,23.633192;113.660248,23.632704;113.659721,23.632172;113.659370,23.631880;113.659256,23.631794;113.658989,23.631588;113.658897,23.631519;113.658211,23.631102;113.657707,23.630760;113.657425,23.630590;113.656944,23.630304;113.656940,23.630304;113.654336,23.628741;113.653850,23.628416;113.653598,23.628225;113.652383,23.627179;113.650165,23.625326;113.650022,23.625221;113.649766,23.625013;113.649731,23.624987;113.649731,23.624983;113.648980,23.624384;113.648611,23.624063;113.647843,23.623442;113.647361,23.623090;113.646780,23.622721;113.646345,23.622465;113.645981,23.622287;113.645595,23.622131;113.645117,23.621992;113.644709,23.621914;113.644640,23.621901;113.644635,23.621901;113.644375,23.621862;113.643255,23.621749;113.642578,23.621667;113.642474,23.621645;113.642027,23.621541;113.641450,23.621354;113.640525,23.621033;113.639332,23.620603;113.639184,23.620543;113.638850,23.620412;113.638433,23.620213;113.638325,23.620156;113.638329,23.620155;113.636047,23.618944;113.635544,23.618668;113.635254,23.618481;113.634750,23.618097;113.634514,23.617891;113.634254,23.617622;113.633980,23.617271;113.633636,23.616779;113.633057,23.615911;113.632957,23.615774;113.632401,23.614927;113.631912,23.614172;113.631660,23.613710;113.631432,23.613142;113.631287,23.612659;113.630905,23.611076;113.630844,23.610802;113.630844,23.610798;113.630768,23.610516;113.630661,23.610060;113.630569,23.609705;113.630554,23.609617;113.630501,23.609388;113.630119,23.607822;113.629776,23.606388;113.629395,23.604740;113.628891,23.602587;113.628479,23.600821;113.628136,23.599293;113.627968,23.598680;113.627953,23.598633;113.627884,23.598433;113.627785,23.598202;113.627632,23.597919;113.627487,23.597683;113.627281,23.597401;113.627037,23.597139;113.626106,23.596230;113.625641,23.595755;113.624992,23.595139;113.624092,23.594326;113.623161,23.593433;113.622879,23.593147;113.622734,23.592981;113.622383,23.592590;113.622055,23.592186;113.621872,23.591957;113.621574,23.591545;113.621292,23.591133;113.621117,23.590864;113.620880,23.590433;113.620735,23.590164;113.620674,23.590054;113.620673,23.590052;113.620603,23.589913;113.619475,23.587643;113.619401,23.587491;113.619401,23.587487;113.619175,23.587040;113.618984,23.586658;113.618893,23.586471;113.618598,23.585868;113.618108,23.584874;113.617930,23.584440;113.617769,23.583928;113.617708,23.583646;113.617630,23.583073;113.617582,23.582478;113.617578,23.582357;113.617578,23.582361;113.617584,23.582365;113.617584,23.582359;113.617554,23.581884;113.617485,23.580811;113.617477,23.580591;113.617485,23.580204;113.617493,23.579849;113.617554,23.579384;113.617668,23.578743;113.617760,23.578316;113.617790,23.578138;113.618042,23.576904;113.618080,23.576723;113.618095,23.576658;113.618118,23.576557;113.618187,23.576189;113.618347,23.575378;113.618416,23.574808;113.618423,23.574497;113.618408,23.574158;113.618286,23.573481;113.618263,23.573381;113.618210,23.573103;113.618210,23.573111;113.618210,23.573120;113.618210,23.573116;113.618172,23.572929;113.618080,23.572432;113.618034,23.572153;113.618011,23.571901;113.617989,23.571444;113.618034,23.570911;113.618187,23.569813;113.618332,23.568825;113.618462,23.567951;113.618652,23.566698;113.618759,23.565947;113.618790,23.565674;113.618828,23.565474;113.618843,23.565365;113.618874,23.565182;113.618896,23.565014;113.618896,23.564964;113.619118,23.563465;113.619171,23.563156;113.619263,23.562523;113.619286,23.562109;113.619263,23.561775;113.619232,23.561602;113.619171,23.561384;113.619011,23.561010;113.618790,23.560673;113.618652,23.560495;113.618149,23.559973;113.617950,23.559765;113.616966,23.558811;113.615730,23.557600;113.615547,23.557409',\n",
       "         'bustimetag': '2',\n",
       "         'start_time': '0900',\n",
       "         'end_time': '1800',\n",
       "         'via_num': '12',\n",
       "         'via_stops': [{'name': '卫东',\n",
       "           'id': '900000111141003',\n",
       "           'location': '113.671707,23.643766'},\n",
       "          {'name': '交警温泉中队',\n",
       "           'id': '900000111141029',\n",
       "           'location': '113.656944,23.630304'},\n",
       "          {'name': '冲口',\n",
       "           'id': '900000111141022',\n",
       "           'location': '113.649731,23.624987'},\n",
       "          {'name': '牛步迳',\n",
       "           'id': '900000111141006',\n",
       "           'location': '113.644640,23.621901'},\n",
       "          {'name': '华辉度假村',\n",
       "           'id': '900000111141023',\n",
       "           'location': '113.638325,23.620156'},\n",
       "          {'name': '温泉镇政府',\n",
       "           'id': '900000111141008',\n",
       "           'location': '113.632957,23.615774'},\n",
       "          {'name': '云星村',\n",
       "           'id': '900000111141024',\n",
       "           'location': '113.630844,23.610802'},\n",
       "          {'name': '宣星路口',\n",
       "           'id': '900000111141010',\n",
       "           'location': '113.628891,23.602587'},\n",
       "          {'name': '新华',\n",
       "           'id': '900000111141011',\n",
       "           'location': '113.620674,23.590054'},\n",
       "          {'name': '水底村',\n",
       "           'id': '900000111141012',\n",
       "           'location': '113.619401,23.587491'},\n",
       "          {'name': '南洋学院',\n",
       "           'id': '900000111141028',\n",
       "           'location': '113.617578,23.582357'},\n",
       "          {'name': '江埔社区',\n",
       "           'id': '900000111141014',\n",
       "           'location': '113.618210,23.573103'}]}]},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}},\n",
       "     {'taxi': [],\n",
       "      'walking': {'origin': '113.615540,23.557413',\n",
       "       'destination': '113.615593,23.557280',\n",
       "       'distance': '65',\n",
       "       'duration': '55',\n",
       "       'steps': [{'instruction': '沿环市东路步行22米右转',\n",
       "         'road': '环市东路',\n",
       "         'distance': '22',\n",
       "         'duration': [],\n",
       "         'polyline': '113.615540,23.557413;113.615692,23.557562',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行14米右转',\n",
       "         'road': [],\n",
       "         'distance': '14',\n",
       "         'duration': [],\n",
       "         'polyline': '113.615692,23.557562;113.615791,23.557474',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿环市东路步行29米到达沙塱村',\n",
       "         'road': '环市东路',\n",
       "         'distance': '29',\n",
       "         'duration': [],\n",
       "         'polyline': '113.615791,23.557470;113.615593,23.557280',\n",
       "         'action': [],\n",
       "         'assistant_action': '到达沙塱村'}]},\n",
       "      'bus': {'buslines': [{'departure_stop': {'name': '沙塱村',\n",
       "          'id': '900000136632007',\n",
       "          'location': '113.615593,23.557276'},\n",
       "         'arrival_stop': {'name': '龙岗墟',\n",
       "          'id': '900000136632023',\n",
       "          'location': '113.668095,23.600482'},\n",
       "         'name': '从19路密石班车(从化汽车站(总站)--密石村委总站)',\n",
       "         'id': '900000136632',\n",
       "         'type': '普通公交线路',\n",
       "         'distance': '8168',\n",
       "         'duration': '1401',\n",
       "         'polyline': '113.615593,23.557276;113.617615,23.559267;113.618256,23.559896;113.618553,23.559795;113.619087,23.559740;113.619179,23.559727;113.619423,23.559740;113.619576,23.559753;113.620224,23.559923;113.620605,23.560009;113.621513,23.560223;113.621765,23.560314;113.621941,23.560417;113.622047,23.560520;113.622650,23.561180;113.622993,23.561588;113.623207,23.561768;113.623497,23.561905;113.624428,23.562178;113.624985,23.562361;113.625954,23.562677;113.626251,23.562805;113.626572,23.563000;113.627411,23.563646;113.627563,23.563810;113.627655,23.563944;113.628059,23.564587;113.628258,23.565022;113.628357,23.565168;113.628922,23.565674;113.629059,23.565794;113.629593,23.566454;113.630104,23.566879;113.630455,23.567154;113.630737,23.567383;113.630882,23.567469;113.631088,23.567652;113.631218,23.567831;113.631325,23.568047;113.631439,23.568333;113.631699,23.568993;113.631798,23.569153;113.631859,23.569218;113.631989,23.569313;113.632370,23.569489;113.632774,23.569632;113.632957,23.569666;113.632977,23.569670;113.633031,23.569679;113.633090,23.569691;113.633203,23.569692;113.633247,23.569687;113.633484,23.569675;113.633743,23.569613;113.635330,23.569057;113.636597,23.568642;113.636711,23.568607;113.636932,23.568560;113.637207,23.568516;113.637421,23.568502;113.637695,23.568525;113.638046,23.568607;113.638390,23.568743;113.638901,23.569002;113.640404,23.569818;113.640648,23.569973;113.640862,23.570150;113.640953,23.570255;113.641068,23.570396;113.641167,23.570520;113.641434,23.570816;113.641632,23.570997;113.641975,23.571224;113.642319,23.571407;113.642540,23.571497;113.642578,23.571507;113.642937,23.571627;113.643044,23.571650;113.643288,23.571680;113.643501,23.571680;113.643639,23.571680;113.643967,23.571676;113.644615,23.571671;113.644882,23.571703;113.644966,23.571726;113.645241,23.571863;113.645958,23.572365;113.646194,23.572559;113.646416,23.572773;113.646606,23.572956;113.646790,23.573151;113.647270,23.573637;113.647408,23.573751;113.649239,23.575178;113.649574,23.575447;113.649620,23.575481;113.649673,23.575529;113.650375,23.576088;113.651077,23.576658;113.651428,23.576935;113.651657,23.577105;113.652000,23.577383;113.652443,23.577700;113.652702,23.577860;113.653313,23.578178;113.653305,23.578178;113.653435,23.578241;113.653679,23.578369;113.654556,23.578844;113.654915,23.579020;113.655090,23.579084;113.656052,23.579311;113.656410,23.579357;113.656586,23.579485;113.656723,23.579639;113.657234,23.580214;113.657288,23.580305;113.657394,23.580610;113.657433,23.580772;113.657486,23.582104;113.657486,23.582232;113.657463,23.582340;113.657433,23.582439;113.657379,23.582541;113.657158,23.582848;113.657066,23.583025;113.656975,23.583256;113.656891,23.583569;113.656868,23.583675;113.656883,23.583780;113.656906,23.583920;113.657059,23.584450;113.657112,23.584566;113.657478,23.585155;113.657516,23.585255;113.657547,23.585365;113.657692,23.586689;113.657745,23.586931;113.657814,23.587135;113.658020,23.587645;113.658096,23.587833;113.658099,23.587830;113.658750,23.589397;113.658819,23.589588;113.659110,23.590226;113.659622,23.591046;113.659826,23.591389;113.659926,23.591589;113.660456,23.592799;113.660543,23.593021;113.660725,23.593594;113.660825,23.593885;113.660903,23.594028;113.661141,23.594410;113.661306,23.594601;113.661554,23.594844;113.662235,23.595430;113.663477,23.596506;113.663737,23.596775;113.664067,23.597135;113.664392,23.597617;113.664549,23.597865;113.664792,23.598234;113.665122,23.598633;113.665252,23.598780;113.665282,23.598819;113.665512,23.599089;113.665777,23.599362;113.665951,23.599501;113.666224,23.599640;113.667322,23.600135;113.667943,23.600412;113.668095,23.600482',\n",
       "         'bustimetag': '2',\n",
       "         'start_time': [],\n",
       "         'end_time': [],\n",
       "         'via_num': '7',\n",
       "         'via_stops': [{'name': '灌村路口',\n",
       "           'id': '900000136632008',\n",
       "           'location': '113.619087,23.559740'},\n",
       "          {'name': '福上下社2',\n",
       "           'id': '900000136632009',\n",
       "           'location': '113.633203,23.569692'},\n",
       "          {'name': '石海村',\n",
       "           'id': '900000136632010',\n",
       "           'location': '113.641068,23.570396'},\n",
       "          {'name': '石海小学',\n",
       "           'id': '900000136632011',\n",
       "           'location': '113.643639,23.571680'},\n",
       "          {'name': '石海村委',\n",
       "           'id': '900000136632012',\n",
       "           'location': '113.649620,23.575481'},\n",
       "          {'name': '灌村围',\n",
       "           'id': '900000136632013',\n",
       "           'location': '113.653313,23.578178'},\n",
       "          {'name': '中田里',\n",
       "           'id': '900000136632014',\n",
       "           'location': '113.658096,23.587833'}]},\n",
       "        {'departure_stop': {'name': '沙塱村',\n",
       "          'id': '900000111136007',\n",
       "          'location': '113.615593,23.557278'},\n",
       "         'arrival_stop': {'name': '龙岗墟',\n",
       "          'id': '900000111136028',\n",
       "          'location': '113.668082,23.600477'},\n",
       "         'name': '从19路(从化汽车站总站--高坣总站)',\n",
       "         'id': '900000111136',\n",
       "         'type': '普通公交线路',\n",
       "         'distance': '8259',\n",
       "         'duration': '2815',\n",
       "         'polyline': '113.615593,23.557278;113.615590,23.557274;113.617622,23.559266;113.618247,23.559887;113.618555,23.559796;113.618976,23.559753;113.619180,23.559727;113.619423,23.559740;113.619575,23.559753;113.620221,23.559922;113.620603,23.560009;113.621510,23.560221;113.621766,23.560312;113.621936,23.560417;113.622044,23.560521;113.622652,23.561181;113.622995,23.561589;113.623212,23.561766;113.623490,23.561905;113.624427,23.562179;113.624983,23.562361;113.625955,23.562678;113.626250,23.562804;113.626567,23.562999;113.627409,23.563646;113.627565,23.563811;113.627656,23.563945;113.628060,23.564588;113.628260,23.565022;113.628355,23.565169;113.628924,23.565673;113.629058,23.565794;113.629588,23.566454;113.630109,23.566879;113.630451,23.567153;113.630742,23.567383;113.630877,23.567470;113.631085,23.567652;113.631220,23.567830;113.631328,23.568047;113.631367,23.568147;113.631441,23.568333;113.631697,23.568993;113.631793,23.569154;113.631853,23.569219;113.631988,23.569314;113.632374,23.569488;113.632773,23.569631;113.633060,23.569683;113.633247,23.569688;113.633372,23.569679;113.633368,23.569683;113.633485,23.569674;113.633746,23.569614;113.635330,23.569058;113.636593,23.568641;113.636832,23.568581;113.637205,23.568516;113.637426,23.568503;113.637695,23.568524;113.638047,23.568607;113.638390,23.568741;113.638637,23.568867;113.638633,23.568867;113.638898,23.569002;113.640399,23.569818;113.640647,23.569974;113.640859,23.570152;113.640955,23.570256;113.641163,23.570521;113.641428,23.570816;113.641632,23.570998;113.641970,23.571224;113.642322,23.571406;113.642543,23.571497;113.642578,23.571506;113.642930,23.571628;113.643043,23.571649;113.643286,23.571680;113.643503,23.571680;113.643628,23.571680;113.643624,23.571680;113.643967,23.571675;113.644614,23.571671;113.644878,23.571701;113.644970,23.571727;113.645247,23.571862;113.645959,23.572365;113.646198,23.572561;113.646415,23.572773;113.646606,23.572956;113.646788,23.573151;113.647274,23.573637;113.647405,23.573750;113.649232,23.575178;113.649575,23.575447;113.649618,23.575486;113.649618,23.575482;113.649674,23.575530;113.650378,23.576089;113.651076,23.576658;113.651432,23.576936;113.651649,23.577105;113.652001,23.577383;113.652448,23.577700;113.652704,23.577860;113.653177,23.578108;113.653173,23.578108;113.653429,23.578242;113.653676,23.578368;113.654562,23.578845;113.654913,23.579019;113.655091,23.579084;113.656050,23.579310;113.656411,23.579358;113.656589,23.579484;113.656723,23.579640;113.657235,23.580213;113.657292,23.580304;113.657396,23.580612;113.657431,23.580773;113.657483,23.582105;113.657483,23.582231;113.657470,23.582339;113.657431,23.582439;113.657378,23.582539;113.657157,23.582847;113.657066,23.583025;113.656979,23.583255;113.656888,23.583568;113.656871,23.583676;113.656879,23.583780;113.656905,23.583919;113.657062,23.584449;113.657114,23.584566;113.657322,23.584891;113.657478,23.585156;113.657548,23.585365;113.657691,23.586688;113.657743,23.586931;113.657813,23.587135;113.658021,23.587643;113.658099,23.587830;113.658095,23.587830;113.658750,23.589397;113.658819,23.589588;113.659110,23.590226;113.659622,23.591046;113.659826,23.591389;113.659926,23.591589;113.660456,23.592799;113.660543,23.593021;113.660725,23.593594;113.660825,23.593885;113.660903,23.594028;113.660990,23.594167;113.660990,23.594171;113.660990,23.594167;113.661141,23.594410;113.661306,23.594601;113.661554,23.594844;113.662235,23.595430;113.663477,23.596506;113.663737,23.596775;113.664067,23.597135;113.664392,23.597617;113.664549,23.597865;113.664792,23.598234;113.665122,23.598633;113.665252,23.598780;113.665282,23.598819;113.665512,23.599089;113.665777,23.599362;113.665951,23.599501;113.666224,23.599640;113.667322,23.600135;113.667943,23.600412;113.668082,23.600477',\n",
       "         'bustimetag': '2',\n",
       "         'start_time': '0700',\n",
       "         'end_time': '1800',\n",
       "         'via_num': '9',\n",
       "         'via_stops': [{'name': '灌村路口',\n",
       "           'id': '900000111136045',\n",
       "           'location': '113.618976,23.559753'},\n",
       "          {'name': '福上下社1',\n",
       "           'id': '900000111136037',\n",
       "           'location': '113.631367,23.568147'},\n",
       "          {'name': '福上下社2',\n",
       "           'id': '900000111136038',\n",
       "           'location': '113.633372,23.569679'},\n",
       "          {'name': '石海村',\n",
       "           'id': '900000111136039',\n",
       "           'location': '113.638637,23.568867'},\n",
       "          {'name': '石海小学',\n",
       "           'id': '900000111136040',\n",
       "           'location': '113.643628,23.571680'},\n",
       "          {'name': '石海村委',\n",
       "           'id': '900000111136041',\n",
       "           'location': '113.649618,23.575486'},\n",
       "          {'name': '灌村围',\n",
       "           'id': '900000111136042',\n",
       "           'location': '113.653177,23.578108'},\n",
       "          {'name': '中田里',\n",
       "           'id': '900000111136047',\n",
       "           'location': '113.658099,23.587830'},\n",
       "          {'name': '石桥社',\n",
       "           'id': '900000111136043',\n",
       "           'location': '113.660990,23.594167'}]}]},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}},\n",
       "     {'taxi': [],\n",
       "      'walking': {'origin': '113.668083,23.600477',\n",
       "       'destination': '113.667816,23.600794',\n",
       "       'distance': '59',\n",
       "       'duration': '50',\n",
       "       'steps': [{'instruction': '沿桃园东路步行15米右转',\n",
       "         'road': '桃园东路',\n",
       "         'distance': '15',\n",
       "         'duration': [],\n",
       "         'polyline': '113.668083,23.600477;113.667946,23.600416',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿龙泉路步行44米',\n",
       "         'road': '龙泉路',\n",
       "         'distance': '44',\n",
       "         'duration': [],\n",
       "         'polyline': '113.667946,23.600412;113.667816,23.600794',\n",
       "         'action': [],\n",
       "         'assistant_action': []}]},\n",
       "      'bus': {'buslines': []},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}}]},\n",
       "   {'cost': [],\n",
       "    'duration': '4719',\n",
       "    'nightflag': '0',\n",
       "    'walking_distance': '545',\n",
       "    'distance': '17403',\n",
       "    'missed': '1',\n",
       "    'segments': [{'taxi': [],\n",
       "      'walking': {'origin': '113.679016,23.632349',\n",
       "       'destination': '113.676613,23.631285',\n",
       "       'distance': '513',\n",
       "       'duration': '439',\n",
       "       'steps': [{'instruction': '步行57米右转',\n",
       "         'road': [],\n",
       "         'distance': '57',\n",
       "         'duration': [],\n",
       "         'polyline': '113.679016,23.632349;113.678528,23.632097',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行47米向左前方行走',\n",
       "         'road': [],\n",
       "         'distance': '47',\n",
       "         'duration': [],\n",
       "         'polyline': '113.678528,23.632092;113.678398,23.632166;113.678101,23.632261',\n",
       "         'action': '向左前方行走',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行218米左转',\n",
       "         'road': [],\n",
       "         'distance': '218',\n",
       "         'duration': [],\n",
       "         'polyline': '113.678101,23.632261;113.677834,23.632261;113.677551,23.632200;113.677399,23.632179;113.677284,23.632200;113.677177,23.632244;113.677017,23.632357;113.676811,23.632534;113.676582,23.632778;113.676430,23.632904;113.676292,23.632969',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿博学路步行191米到达中大南方学院',\n",
       "         'road': '博学路',\n",
       "         'distance': '191',\n",
       "         'duration': [],\n",
       "         'polyline': '113.676285,23.632969;113.676292,23.632227;113.676338,23.631948;113.676430,23.631676;113.676491,23.631540;113.676613,23.631285',\n",
       "         'action': [],\n",
       "         'assistant_action': '到达中大南方学院'}]},\n",
       "      'bus': {'buslines': [{'departure_stop': {'name': '中大南方学院',\n",
       "          'id': '900000111141002',\n",
       "          'location': '113.676613,23.631281'},\n",
       "         'arrival_stop': {'name': '冲口',\n",
       "          'id': '900000111141022',\n",
       "          'location': '113.649731,23.624987'},\n",
       "         'name': '从15路(中大南方学院--从化汽车站总站)',\n",
       "         'id': '900000111141',\n",
       "         'type': '普通公交线路',\n",
       "         'distance': '6394',\n",
       "         'duration': '1857',\n",
       "         'polyline': '113.676613,23.631281;113.676460,23.631588;113.676430,23.631672;113.676338,23.631945;113.676292,23.632223;113.676285,23.632969;113.676285,23.633560;113.676300,23.633738;113.676331,23.633875;113.676399,23.634016;113.676460,23.634111;113.676521,23.634193;113.676781,23.634409;113.676857,23.634357;113.676933,23.634340;113.677032,23.634354;113.677094,23.634396;113.677139,23.634459;113.677147,23.634535;113.677139,23.634600;113.677086,23.634663;113.677032,23.634701;113.676918,23.634718;113.676857,23.634701;113.676788,23.634657;113.675262,23.636129;113.675156,23.636263;113.675026,23.636467;113.674973,23.636566;113.674957,23.636702;113.674957,23.636845;113.674995,23.636995;113.675377,23.637886;113.675430,23.638042;113.675522,23.638659;113.675529,23.638998;113.675514,23.639132;113.675446,23.639311;113.675331,23.639582;113.675102,23.640036;113.675003,23.640186;113.674309,23.641024;113.673347,23.642139;113.672981,23.642536;113.672935,23.642578;113.672173,23.643307;113.671707,23.643766;113.671432,23.644045;113.673103,23.644968;113.674362,23.645651;113.675461,23.646276;113.675964,23.646635;113.676407,23.647018;113.676376,23.647089;113.675964,23.646744;113.675735,23.646566;113.675468,23.646385;113.675095,23.646172;113.673004,23.645004;113.669968,23.643330;113.669167,23.642881;113.668770,23.642673;113.668594,23.642578;113.667007,23.641693;113.666145,23.641171;113.665314,23.640564;113.665253,23.640511;113.665016,23.640301;113.664772,23.640064;113.664551,23.639812;113.664406,23.639662;113.664207,23.639400;113.663925,23.639021;113.663574,23.638451;113.663361,23.638020;113.662323,23.635933;113.661949,23.635181;113.661461,23.634266;113.661224,23.633898;113.660843,23.633383;113.660683,23.633192;113.660248,23.632704;113.659721,23.632172;113.659370,23.631880;113.659256,23.631794;113.658989,23.631588;113.658897,23.631519;113.658211,23.631102;113.657707,23.630760;113.657425,23.630590;113.656944,23.630304;113.656940,23.630304;113.654336,23.628741;113.653850,23.628416;113.653598,23.628225;113.652383,23.627179;113.650165,23.625326;113.650022,23.625221;113.649766,23.625013;113.649731,23.624987',\n",
       "         'bustimetag': '2',\n",
       "         'start_time': '0900',\n",
       "         'end_time': '1800',\n",
       "         'via_num': '2',\n",
       "         'via_stops': [{'name': '卫东',\n",
       "           'id': '900000111141003',\n",
       "           'location': '113.671707,23.643766'},\n",
       "          {'name': '交警温泉中队',\n",
       "           'id': '900000111141029',\n",
       "           'location': '113.656944,23.630304'}]}]},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}},\n",
       "     {'taxi': [],\n",
       "      'walking': [],\n",
       "      'bus': {'buslines': [{'departure_stop': {'name': '冲口',\n",
       "          'id': '900000111218004',\n",
       "          'location': '113.649731,23.624983'},\n",
       "         'arrival_stop': {'name': '龙岗墟',\n",
       "          'id': '900000111218023',\n",
       "          'location': '113.667899,23.600530'},\n",
       "         'name': '从701路(温泉宾馆--南平村委)',\n",
       "         'id': '900000111218',\n",
       "         'type': '微循环公交',\n",
       "         'distance': '10464',\n",
       "         'duration': '2395',\n",
       "         'polyline': '113.649731,23.624983;113.649727,23.624983;113.648980,23.624384;113.648611,23.624063;113.647843,23.623442;113.647361,23.623090;113.646780,23.622721;113.646345,23.622465;113.645981,23.622287;113.645595,23.622131;113.645117,23.621992;113.644709,23.621914;113.644648,23.621901;113.644644,23.621901;113.644375,23.621862;113.643255,23.621749;113.642578,23.621667;113.642474,23.621645;113.642027,23.621541;113.641450,23.621354;113.640525,23.621033;113.639332,23.620603;113.639184,23.620543;113.638850,23.620412;113.638433,23.620213;113.638325,23.620156;113.638329,23.620155;113.638329,23.620159;113.638329,23.620155;113.636047,23.618944;113.635544,23.618668;113.635254,23.618481;113.634750,23.618097;113.634514,23.617891;113.634254,23.617622;113.633980,23.617271;113.633636,23.616779;113.633057,23.615911;113.632965,23.615782;113.632957,23.615778;113.632401,23.614927;113.631912,23.614172;113.631660,23.613710;113.631432,23.613142;113.631287,23.612659;113.630905,23.611076;113.630844,23.610802;113.630844,23.610798;113.630768,23.610516;113.630661,23.610060;113.630569,23.609705;113.630554,23.609617;113.630501,23.609388;113.630119,23.607822;113.629776,23.606388;113.629395,23.604740;113.628891,23.602587;113.628479,23.600821;113.628136,23.599293;113.627968,23.598680;113.627953,23.598633;113.627884,23.598433;113.627785,23.598202;113.627632,23.597919;113.627487,23.597683;113.627281,23.597401;113.627037,23.597139;113.626106,23.596230;113.625641,23.595755;113.624992,23.595139;113.624092,23.594326;113.623161,23.593433;113.622879,23.593147;113.622978,23.593065;113.623573,23.593662;113.627022,23.596935;113.627274,23.597191;113.627449,23.597414;113.627663,23.597729;113.627869,23.598082;113.627975,23.598307;113.628059,23.598547;113.628090,23.598633;113.628212,23.599079;113.628616,23.600807;113.628723,23.601263;113.628720,23.601263;113.628811,23.601658;113.629280,23.601780;113.630113,23.601445;113.630365,23.601354;113.632248,23.600681;113.633785,23.600347;113.635725,23.599957;113.636810,23.599731;113.637335,23.599657;113.638103,23.599596;113.638542,23.599579;113.639266,23.599588;113.639427,23.599592;113.642270,23.599570;113.642578,23.599570;113.643043,23.599622;113.643581,23.599688;113.643624,23.599661;113.643911,23.599657;113.644232,23.599605;113.644449,23.599614;113.645451,23.599935;113.646454,23.600278;113.646589,23.600347;113.646658,23.600417;113.646931,23.600595;113.649835,23.601749;113.649935,23.601797;113.650030,23.601862;113.650937,23.602674;113.651063,23.602752;113.651176,23.602786;113.651367,23.602826;113.651584,23.602847;113.651845,23.602847;113.652001,23.602830;113.652504,23.602708;113.652839,23.602582;113.652999,23.602548;113.653181,23.602543;113.653264,23.602561;113.653659,23.602752;113.653802,23.602799;113.654605,23.602977;113.655122,23.603069;113.655243,23.603077;113.655391,23.603069;113.655799,23.602999;113.656055,23.602934;113.656302,23.602847;113.657083,23.602530;113.657300,23.602461;113.657500,23.602418;113.659041,23.602205;113.659501,23.602144;113.660009,23.602170;113.660386,23.602144;113.661046,23.601988;113.661845,23.601801;113.662044,23.601740;113.662687,23.601458;113.662951,23.601385;113.663980,23.601424;113.664275,23.601445;113.664549,23.601489;113.664596,23.601497;113.664714,23.601497;113.665464,23.601280;113.665655,23.601233;113.665864,23.601202;113.666658,23.601441;113.666662,23.601441;113.666658,23.601441;113.666758,23.601467;113.667001,23.601545;113.667222,23.601615;113.667465,23.601688;113.667773,23.600877;113.667899,23.600530',\n",
       "         'bustimetag': '2',\n",
       "         'start_time': [],\n",
       "         'end_time': [],\n",
       "         'via_num': '7',\n",
       "         'via_stops': [{'name': '牛步迳',\n",
       "           'id': '900000111218005',\n",
       "           'location': '113.644648,23.621901'},\n",
       "          {'name': '华辉度假村',\n",
       "           'id': '900000111218006',\n",
       "           'location': '113.638325,23.620156'},\n",
       "          {'name': '温泉镇政府',\n",
       "           'id': '900000111218007',\n",
       "           'location': '113.632965,23.615782'},\n",
       "          {'name': '云星村',\n",
       "           'id': '900000111218008',\n",
       "           'location': '113.630844,23.610802'},\n",
       "          {'name': '宣星路口',\n",
       "           'id': '900000111218009',\n",
       "           'location': '113.628891,23.602587'},\n",
       "          {'name': '宣星路口(星光五金水电商场)',\n",
       "           'id': '900000111218021',\n",
       "           'location': '113.628723,23.601263'},\n",
       "          {'name': '教师村',\n",
       "           'id': '900000111218022',\n",
       "           'location': '113.666658,23.601441'}]}]},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}},\n",
       "     {'taxi': [],\n",
       "      'walking': {'origin': '113.667900,23.600529',\n",
       "       'destination': '113.667816,23.600794',\n",
       "       'distance': '31',\n",
       "       'duration': '26',\n",
       "       'steps': [{'instruction': '沿龙泉路步行31米',\n",
       "         'road': '龙泉路',\n",
       "         'distance': '31',\n",
       "         'duration': [],\n",
       "         'polyline': '113.667900,23.600529;113.667816,23.600794',\n",
       "         'action': [],\n",
       "         'assistant_action': []}]},\n",
       "      'bus': {'buslines': []},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}}]},\n",
       "   {'cost': '4.0',\n",
       "    'duration': '5042',\n",
       "    'nightflag': '0',\n",
       "    'walking_distance': '956',\n",
       "    'distance': '14863',\n",
       "    'missed': '1',\n",
       "    'segments': [{'taxi': [],\n",
       "      'walking': {'origin': '113.679016,23.632349',\n",
       "       'destination': '113.676613,23.631285',\n",
       "       'distance': '513',\n",
       "       'duration': '439',\n",
       "       'steps': [{'instruction': '步行57米右转',\n",
       "         'road': [],\n",
       "         'distance': '57',\n",
       "         'duration': [],\n",
       "         'polyline': '113.679016,23.632349;113.678528,23.632097',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行47米向左前方行走',\n",
       "         'road': [],\n",
       "         'distance': '47',\n",
       "         'duration': [],\n",
       "         'polyline': '113.678528,23.632092;113.678398,23.632166;113.678101,23.632261',\n",
       "         'action': '向左前方行走',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行218米左转',\n",
       "         'road': [],\n",
       "         'distance': '218',\n",
       "         'duration': [],\n",
       "         'polyline': '113.678101,23.632261;113.677834,23.632261;113.677551,23.632200;113.677399,23.632179;113.677284,23.632200;113.677177,23.632244;113.677017,23.632357;113.676811,23.632534;113.676582,23.632778;113.676430,23.632904;113.676292,23.632969',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿博学路步行191米到达中大南方学院',\n",
       "         'road': '博学路',\n",
       "         'distance': '191',\n",
       "         'duration': [],\n",
       "         'polyline': '113.676285,23.632969;113.676292,23.632227;113.676338,23.631948;113.676430,23.631676;113.676491,23.631540;113.676613,23.631285',\n",
       "         'action': [],\n",
       "         'assistant_action': '到达中大南方学院'}]},\n",
       "      'bus': {'buslines': [{'departure_stop': {'name': '中大南方学院',\n",
       "          'id': '900000111141002',\n",
       "          'location': '113.676613,23.631281'},\n",
       "         'arrival_stop': {'name': '宣星路口',\n",
       "          'id': '900000111141010',\n",
       "          'location': '113.628891,23.602587'},\n",
       "         'name': '从15路(中大南方学院--从化汽车站总站)',\n",
       "         'id': '900000111141',\n",
       "         'type': '普通公交线路',\n",
       "         'distance': '9953',\n",
       "         'duration': '2183',\n",
       "         'polyline': '113.676613,23.631281;113.676460,23.631588;113.676430,23.631672;113.676338,23.631945;113.676292,23.632223;113.676285,23.632969;113.676285,23.633560;113.676300,23.633738;113.676331,23.633875;113.676399,23.634016;113.676460,23.634111;113.676521,23.634193;113.676781,23.634409;113.676857,23.634357;113.676933,23.634340;113.677032,23.634354;113.677094,23.634396;113.677139,23.634459;113.677147,23.634535;113.677139,23.634600;113.677086,23.634663;113.677032,23.634701;113.676918,23.634718;113.676857,23.634701;113.676788,23.634657;113.675262,23.636129;113.675156,23.636263;113.675026,23.636467;113.674973,23.636566;113.674957,23.636702;113.674957,23.636845;113.674995,23.636995;113.675377,23.637886;113.675430,23.638042;113.675522,23.638659;113.675529,23.638998;113.675514,23.639132;113.675446,23.639311;113.675331,23.639582;113.675102,23.640036;113.675003,23.640186;113.674309,23.641024;113.673347,23.642139;113.672981,23.642536;113.672935,23.642578;113.672173,23.643307;113.671707,23.643766;113.671432,23.644045;113.673103,23.644968;113.674362,23.645651;113.675461,23.646276;113.675964,23.646635;113.676407,23.647018;113.676376,23.647089;113.675964,23.646744;113.675735,23.646566;113.675468,23.646385;113.675095,23.646172;113.673004,23.645004;113.669968,23.643330;113.669167,23.642881;113.668770,23.642673;113.668594,23.642578;113.667007,23.641693;113.666145,23.641171;113.665314,23.640564;113.665253,23.640511;113.665016,23.640301;113.664772,23.640064;113.664551,23.639812;113.664406,23.639662;113.664207,23.639400;113.663925,23.639021;113.663574,23.638451;113.663361,23.638020;113.662323,23.635933;113.661949,23.635181;113.661461,23.634266;113.661224,23.633898;113.660843,23.633383;113.660683,23.633192;113.660248,23.632704;113.659721,23.632172;113.659370,23.631880;113.659256,23.631794;113.658989,23.631588;113.658897,23.631519;113.658211,23.631102;113.657707,23.630760;113.657425,23.630590;113.656944,23.630304;113.656940,23.630304;113.654336,23.628741;113.653850,23.628416;113.653598,23.628225;113.652383,23.627179;113.650165,23.625326;113.650022,23.625221;113.649766,23.625013;113.649731,23.624987;113.649731,23.624983;113.648980,23.624384;113.648611,23.624063;113.647843,23.623442;113.647361,23.623090;113.646780,23.622721;113.646345,23.622465;113.645981,23.622287;113.645595,23.622131;113.645117,23.621992;113.644709,23.621914;113.644640,23.621901;113.644635,23.621901;113.644375,23.621862;113.643255,23.621749;113.642578,23.621667;113.642474,23.621645;113.642027,23.621541;113.641450,23.621354;113.640525,23.621033;113.639332,23.620603;113.639184,23.620543;113.638850,23.620412;113.638433,23.620213;113.638325,23.620156;113.638329,23.620155;113.636047,23.618944;113.635544,23.618668;113.635254,23.618481;113.634750,23.618097;113.634514,23.617891;113.634254,23.617622;113.633980,23.617271;113.633636,23.616779;113.633057,23.615911;113.632957,23.615774;113.632401,23.614927;113.631912,23.614172;113.631660,23.613710;113.631432,23.613142;113.631287,23.612659;113.630905,23.611076;113.630844,23.610802;113.630844,23.610798;113.630768,23.610516;113.630661,23.610060;113.630569,23.609705;113.630554,23.609617;113.630501,23.609388;113.630119,23.607822;113.629776,23.606388;113.629395,23.604740;113.628891,23.602587',\n",
       "         'bustimetag': '2',\n",
       "         'start_time': '0900',\n",
       "         'end_time': '1800',\n",
       "         'via_num': '7',\n",
       "         'via_stops': [{'name': '卫东',\n",
       "           'id': '900000111141003',\n",
       "           'location': '113.671707,23.643766'},\n",
       "          {'name': '交警温泉中队',\n",
       "           'id': '900000111141029',\n",
       "           'location': '113.656944,23.630304'},\n",
       "          {'name': '冲口',\n",
       "           'id': '900000111141022',\n",
       "           'location': '113.649731,23.624987'},\n",
       "          {'name': '牛步迳',\n",
       "           'id': '900000111141006',\n",
       "           'location': '113.644640,23.621901'},\n",
       "          {'name': '华辉度假村',\n",
       "           'id': '900000111141023',\n",
       "           'location': '113.638325,23.620156'},\n",
       "          {'name': '温泉镇政府',\n",
       "           'id': '900000111141008',\n",
       "           'location': '113.632957,23.615774'},\n",
       "          {'name': '云星村',\n",
       "           'id': '900000111141024',\n",
       "           'location': '113.630844,23.610802'}]}]},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}},\n",
       "     {'taxi': [],\n",
       "      'walking': {'origin': '113.628891,23.602587',\n",
       "       'destination': '113.628723,23.601263',\n",
       "       'distance': '263',\n",
       "       'duration': '225',\n",
       "       'steps': [{'instruction': '沿温泉大道步行52米右转',\n",
       "         'road': '温泉大道',\n",
       "         'distance': '52',\n",
       "         'duration': [],\n",
       "         'polyline': '113.628891,23.602587;113.628998,23.603046',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行13米右转',\n",
       "         'road': [],\n",
       "         'distance': '13',\n",
       "         'duration': [],\n",
       "         'polyline': '113.629005,23.603046;113.629120,23.603025',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿温泉大道步行198米到达宣星路口',\n",
       "         'road': '温泉大道',\n",
       "         'distance': '198',\n",
       "         'duration': [],\n",
       "         'polyline': '113.629120,23.603022;113.628906,23.602083;113.628815,23.601658;113.628723,23.601263',\n",
       "         'action': [],\n",
       "         'assistant_action': '到达宣星路口'}]},\n",
       "      'bus': {'buslines': [{'departure_stop': {'name': '宣星路口',\n",
       "          'id': '900000111131022',\n",
       "          'location': '113.628720,23.601263'},\n",
       "         'arrival_stop': {'name': '教师村',\n",
       "          'id': '900000111131041',\n",
       "          'location': '113.666658,23.601437'},\n",
       "         'name': '从14路(从化汽车站总站--高坣总站)',\n",
       "         'id': '900000111131',\n",
       "         'type': '普通公交线路',\n",
       "         'distance': '3954',\n",
       "         'duration': '2040',\n",
       "         'polyline': '113.628720,23.601263;113.628720,23.601259;113.628811,23.601658;113.629280,23.601780;113.630113,23.601445;113.630365,23.601354;113.632248,23.600681;113.633785,23.600347;113.635725,23.599957;113.636810,23.599731;113.637335,23.599657;113.638103,23.599596;113.638542,23.599579;113.639266,23.599588;113.639427,23.599592;113.642270,23.599570;113.642578,23.599570;113.643043,23.599622;113.643294,23.599653;113.643290,23.599653;113.643581,23.599688;113.643624,23.599661;113.643911,23.599657;113.644232,23.599605;113.644449,23.599614;113.645451,23.599935;113.646454,23.600278;113.646589,23.600347;113.646658,23.600417;113.646931,23.600595;113.649835,23.601749;113.649935,23.601797;113.650030,23.601862;113.650937,23.602674;113.651063,23.602752;113.651176,23.602786;113.651367,23.602826;113.651584,23.602847;113.651845,23.602847;113.652001,23.602830;113.652504,23.602708;113.652839,23.602582;113.652999,23.602548;113.653181,23.602543;113.653264,23.602561;113.653659,23.602752;113.653802,23.602799;113.654605,23.602977;113.655122,23.603069;113.655243,23.603077;113.655391,23.603069;113.655799,23.602999;113.656055,23.602934;113.656302,23.602847;113.657083,23.602530;113.657300,23.602461;113.657500,23.602418;113.659041,23.602205;113.659501,23.602144;113.660009,23.602170;113.660386,23.602144;113.661046,23.601988;113.661115,23.601975;113.661115,23.601970;113.661115,23.601975;113.661845,23.601801;113.662044,23.601740;113.662687,23.601458;113.662951,23.601385;113.663980,23.601424;113.664275,23.601445;113.664549,23.601489;113.664596,23.601497;113.664714,23.601497;113.665464,23.601280;113.665655,23.601233;113.665864,23.601202;113.666658,23.601437',\n",
       "         'bustimetag': '2',\n",
       "         'start_time': '0700',\n",
       "         'end_time': '1840',\n",
       "         'via_num': '2',\n",
       "         'via_stops': [{'name': '宣星村委',\n",
       "           'id': '900000111131038',\n",
       "           'location': '113.643294,23.599653'},\n",
       "          {'name': '鸡笼岗路口',\n",
       "           'id': '900000111131040',\n",
       "           'location': '113.661115,23.601975'}]}]},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}},\n",
       "     {'taxi': [],\n",
       "      'walking': {'origin': '113.666656,23.601437',\n",
       "       'destination': '113.667778,23.600882',\n",
       "       'distance': '180',\n",
       "       'duration': '154',\n",
       "       'steps': [{'instruction': '沿龙宣街步行86米右转',\n",
       "         'road': '龙宣街',\n",
       "         'distance': '86',\n",
       "         'duration': [],\n",
       "         'polyline': '113.666656,23.601437;113.666763,23.601467;113.667221,23.601614;113.667458,23.601688',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿龙泉路步行94米',\n",
       "         'road': '龙泉路',\n",
       "         'distance': '94',\n",
       "         'duration': [],\n",
       "         'polyline': '113.667458,23.601688;113.667564,23.601440;113.667671,23.601164;113.667778,23.600882',\n",
       "         'action': [],\n",
       "         'assistant_action': []}]},\n",
       "      'bus': {'buslines': []},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}}]},\n",
       "   {'cost': [],\n",
       "    'duration': '5570',\n",
       "    'nightflag': '0',\n",
       "    'walking_distance': '1880',\n",
       "    'distance': '17880',\n",
       "    'missed': '1',\n",
       "    'segments': [{'taxi': [],\n",
       "      'walking': {'origin': '113.679588,23.632856',\n",
       "       'destination': '113.671761,23.643719',\n",
       "       'distance': '1701',\n",
       "       'duration': '1458',\n",
       "       'steps': [{'instruction': '步行92米向左前方行走',\n",
       "         'road': [],\n",
       "         'distance': '92',\n",
       "         'duration': [],\n",
       "         'polyline': '113.679588,23.632856;113.679588,23.633173;113.679588,23.633251;113.679619,23.633650;113.679649,23.633690',\n",
       "         'action': '向左前方行走',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿博学路步行197米左转',\n",
       "         'road': '博学路',\n",
       "         'distance': '197',\n",
       "         'duration': [],\n",
       "         'polyline': '113.679649,23.633690;113.679550,23.633966;113.679375,23.634357;113.679253,23.634480;113.679062,23.634657;113.678932,23.634762;113.678711,23.634918;113.678635,23.634970;113.678596,23.635031;113.678558,23.635109',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿博学路步行163米右转',\n",
       "         'road': '博学路',\n",
       "         'distance': '163',\n",
       "         'duration': [],\n",
       "         'polyline': '113.678558,23.635109;113.677856,23.635092;113.677612,23.635035;113.677536,23.634996;113.677330,23.634857;113.677086,23.634670',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿博学路步行33米右转',\n",
       "         'road': '博学路',\n",
       "         'distance': '33',\n",
       "         'duration': [],\n",
       "         'polyline': '113.677086,23.634666;113.677025,23.634701;113.676918,23.634718;113.676857,23.634705;113.676796,23.634661',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿中山路步行1216米到达中大南方',\n",
       "         'road': '中山路',\n",
       "         'distance': '1216',\n",
       "         'duration': [],\n",
       "         'polyline': '113.676796,23.634657;113.675270,23.636129;113.675156,23.636263;113.675026,23.636467;113.674973,23.636566;113.674957,23.636702;113.674957,23.636845;113.674988,23.636997;113.675385,23.637886;113.675430,23.638042;113.675522,23.638659;113.675522,23.638998;113.675507,23.639132;113.675453,23.639311;113.675331,23.639584;113.675110,23.640036;113.675003,23.640186;113.674316,23.641024;113.673363,23.642139;113.672981,23.642534;113.672173,23.643303;113.671761,23.643719',\n",
       "         'action': [],\n",
       "         'assistant_action': '到达中大南方'}]},\n",
       "      'bus': {'buslines': [{'departure_stop': {'name': '中大南方',\n",
       "          'id': '900000111225001',\n",
       "          'location': '113.671753,23.643720'},\n",
       "         'arrival_stop': {'name': '富力泉天下',\n",
       "          'id': '900000111225003',\n",
       "          'location': '113.658902,23.636606'},\n",
       "         'name': '从702路(中大南方--乌石村)',\n",
       "         'id': '900000111225',\n",
       "         'type': '微循环公交',\n",
       "         'distance': '3669',\n",
       "         'duration': '1220',\n",
       "         'polyline': '113.671753,23.643720;113.671428,23.644045;113.671636,23.644162;113.673103,23.644970;113.674366,23.645651;113.675460,23.646276;113.675968,23.646636;113.676411,23.647018;113.676367,23.647088;113.675964,23.646745;113.675734,23.646567;113.675464,23.646385;113.675095,23.646172;113.673003,23.645004;113.671827,23.644358;113.671823,23.644358;113.669961,23.643329;113.669162,23.642882;113.668776,23.642674;113.668598,23.642578;113.667001,23.641693;113.666141,23.641172;113.665317,23.640564;113.665252,23.640512;113.665017,23.640299;113.664774,23.640065;113.664549,23.639813;113.664410,23.639661;113.664201,23.639401;113.663928,23.639019;113.663576,23.638451;113.663359,23.638021;113.662322,23.635933;113.661949,23.635182;113.661454,23.634266;113.661224,23.633898;113.660842,23.633381;113.660686,23.633190;113.660252,23.632704;113.660056,23.632613;113.659887,23.632569;113.659666,23.632609;113.659566,23.632648;113.659479,23.632695;113.659379,23.632786;113.659232,23.632986;113.659258,23.633407;113.659232,23.633767;113.659188,23.634154;113.658958,23.636133;113.658902,23.636606',\n",
       "         'bustimetag': '2',\n",
       "         'start_time': [],\n",
       "         'end_time': [],\n",
       "         'via_num': '1',\n",
       "         'via_stops': [{'name': '卫东',\n",
       "           'id': '900000111225002',\n",
       "           'location': '113.671827,23.644358'}]}]},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}},\n",
       "     {'taxi': [],\n",
       "      'walking': {'origin': '113.658897,23.636610',\n",
       "       'destination': '113.658730,23.636814',\n",
       "       'distance': '148',\n",
       "       'duration': '126',\n",
       "       'steps': [{'instruction': '沿景泉大道步行53米右转',\n",
       "         'road': '景泉大道',\n",
       "         'distance': '53',\n",
       "         'duration': [],\n",
       "         'polyline': '113.658897,23.636610;113.658958,23.636137',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行16米右转',\n",
       "         'road': [],\n",
       "         'distance': '16',\n",
       "         'duration': [],\n",
       "         'polyline': '113.658958,23.636133;113.658806,23.636106',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '沿景泉大道步行79米到达富力泉天下',\n",
       "         'road': '景泉大道',\n",
       "         'distance': '79',\n",
       "         'duration': [],\n",
       "         'polyline': '113.658798,23.636103;113.658730,23.636814',\n",
       "         'action': [],\n",
       "         'assistant_action': '到达富力泉天下'}]},\n",
       "      'bus': {'buslines': [{'departure_stop': {'name': '富力泉天下',\n",
       "          'id': '900000111218002',\n",
       "          'location': '113.658722,23.636818'},\n",
       "         'arrival_stop': {'name': '龙岗墟',\n",
       "          'id': '900000111218023',\n",
       "          'location': '113.667899,23.600530'},\n",
       "         'name': '从701路(温泉宾馆--南平村委)',\n",
       "         'id': '900000111218',\n",
       "         'type': '微循环公交',\n",
       "         'distance': '12331',\n",
       "         'duration': '2739',\n",
       "         'polyline': '113.658722,23.636818;113.658722,23.636814;113.658798,23.636103;113.659019,23.634579;113.659126,23.633615;113.659142,23.633429;113.659096,23.632746;113.659004,23.632458;113.658859,23.632105;113.658569,23.631588;113.658485,23.631449;113.658356,23.631262;113.658211,23.631102;113.657707,23.630760;113.657425,23.630590;113.656937,23.630295;113.656931,23.630295;113.654336,23.628741;113.653850,23.628416;113.653598,23.628225;113.652383,23.627179;113.650165,23.625326;113.650022,23.625221;113.649766,23.625013;113.649731,23.624983;113.649727,23.624983;113.648980,23.624384;113.648611,23.624063;113.647843,23.623442;113.647361,23.623090;113.646780,23.622721;113.646345,23.622465;113.645981,23.622287;113.645595,23.622131;113.645117,23.621992;113.644709,23.621914;113.644648,23.621901;113.644644,23.621901;113.644375,23.621862;113.643255,23.621749;113.642578,23.621667;113.642474,23.621645;113.642027,23.621541;113.641450,23.621354;113.640525,23.621033;113.639332,23.620603;113.639184,23.620543;113.638850,23.620412;113.638433,23.620213;113.638325,23.620156;113.638329,23.620155;113.638329,23.620159;113.638329,23.620155;113.636047,23.618944;113.635544,23.618668;113.635254,23.618481;113.634750,23.618097;113.634514,23.617891;113.634254,23.617622;113.633980,23.617271;113.633636,23.616779;113.633057,23.615911;113.632965,23.615782;113.632957,23.615778;113.632401,23.614927;113.631912,23.614172;113.631660,23.613710;113.631432,23.613142;113.631287,23.612659;113.630905,23.611076;113.630844,23.610802;113.630844,23.610798;113.630768,23.610516;113.630661,23.610060;113.630569,23.609705;113.630554,23.609617;113.630501,23.609388;113.630119,23.607822;113.629776,23.606388;113.629395,23.604740;113.628891,23.602587;113.628479,23.600821;113.628136,23.599293;113.627968,23.598680;113.627953,23.598633;113.627884,23.598433;113.627785,23.598202;113.627632,23.597919;113.627487,23.597683;113.627281,23.597401;113.627037,23.597139;113.626106,23.596230;113.625641,23.595755;113.624992,23.595139;113.624092,23.594326;113.623161,23.593433;113.622879,23.593147;113.622978,23.593065;113.623573,23.593662;113.627022,23.596935;113.627274,23.597191;113.627449,23.597414;113.627663,23.597729;113.627869,23.598082;113.627975,23.598307;113.628059,23.598547;113.628090,23.598633;113.628212,23.599079;113.628616,23.600807;113.628723,23.601263;113.628720,23.601263;113.628811,23.601658;113.629280,23.601780;113.630113,23.601445;113.630365,23.601354;113.632248,23.600681;113.633785,23.600347;113.635725,23.599957;113.636810,23.599731;113.637335,23.599657;113.638103,23.599596;113.638542,23.599579;113.639266,23.599588;113.639427,23.599592;113.642270,23.599570;113.642578,23.599570;113.643043,23.599622;113.643581,23.599688;113.643624,23.599661;113.643911,23.599657;113.644232,23.599605;113.644449,23.599614;113.645451,23.599935;113.646454,23.600278;113.646589,23.600347;113.646658,23.600417;113.646931,23.600595;113.649835,23.601749;113.649935,23.601797;113.650030,23.601862;113.650937,23.602674;113.651063,23.602752;113.651176,23.602786;113.651367,23.602826;113.651584,23.602847;113.651845,23.602847;113.652001,23.602830;113.652504,23.602708;113.652839,23.602582;113.652999,23.602548;113.653181,23.602543;113.653264,23.602561;113.653659,23.602752;113.653802,23.602799;113.654605,23.602977;113.655122,23.603069;113.655243,23.603077;113.655391,23.603069;113.655799,23.602999;113.656055,23.602934;113.656302,23.602847;113.657083,23.602530;113.657300,23.602461;113.657500,23.602418;113.659041,23.602205;113.659501,23.602144;113.660009,23.602170;113.660386,23.602144;113.661046,23.601988;113.661845,23.601801;113.662044,23.601740;113.662687,23.601458;113.662951,23.601385;113.663980,23.601424;113.664275,23.601445;113.664549,23.601489;113.664596,23.601497;113.664714,23.601497;113.665464,23.601280;113.665655,23.601233;113.665864,23.601202;113.666658,23.601441;113.666662,23.601441;113.666658,23.601441;113.666758,23.601467;113.667001,23.601545;113.667222,23.601615;113.667465,23.601688;113.667773,23.600877;113.667899,23.600530',\n",
       "         'bustimetag': '2',\n",
       "         'start_time': [],\n",
       "         'end_time': [],\n",
       "         'via_num': '9',\n",
       "         'via_stops': [{'name': '交警温泉中队',\n",
       "           'id': '900000111218020',\n",
       "           'location': '113.656937,23.630295'},\n",
       "          {'name': '冲口',\n",
       "           'id': '900000111218004',\n",
       "           'location': '113.649731,23.624983'},\n",
       "          {'name': '牛步迳',\n",
       "           'id': '900000111218005',\n",
       "           'location': '113.644648,23.621901'},\n",
       "          {'name': '华辉度假村',\n",
       "           'id': '900000111218006',\n",
       "           'location': '113.638325,23.620156'},\n",
       "          {'name': '温泉镇政府',\n",
       "           'id': '900000111218007',\n",
       "           'location': '113.632965,23.615782'},\n",
       "          {'name': '云星村',\n",
       "           'id': '900000111218008',\n",
       "           'location': '113.630844,23.610802'},\n",
       "          {'name': '宣星路口',\n",
       "           'id': '900000111218009',\n",
       "           'location': '113.628891,23.602587'},\n",
       "          {'name': '宣星路口(星光五金水电商场)',\n",
       "           'id': '900000111218021',\n",
       "           'location': '113.628723,23.601263'},\n",
       "          {'name': '教师村',\n",
       "           'id': '900000111218022',\n",
       "           'location': '113.666658,23.601441'}]}]},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}},\n",
       "     {'taxi': [],\n",
       "      'walking': {'origin': '113.667900,23.600529',\n",
       "       'destination': '113.667816,23.600794',\n",
       "       'distance': '31',\n",
       "       'duration': '26',\n",
       "       'steps': [{'instruction': '沿龙泉路步行31米',\n",
       "         'road': '龙泉路',\n",
       "         'distance': '31',\n",
       "         'duration': [],\n",
       "         'polyline': '113.667900,23.600529;113.667816,23.600794',\n",
       "         'action': [],\n",
       "         'assistant_action': []}]},\n",
       "      'bus': {'buslines': []},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}}]},\n",
       "   {'cost': [],\n",
       "    'duration': '6174',\n",
       "    'nightflag': '0',\n",
       "    'walking_distance': '1989',\n",
       "    'distance': '18630',\n",
       "    'missed': '1',\n",
       "    'segments': [{'taxi': [],\n",
       "      'walking': {'origin': '113.679588,23.632492',\n",
       "       'destination': '113.675644,23.619991',\n",
       "       'distance': '1957',\n",
       "       'duration': '1677',\n",
       "       'steps': [{'instruction': '步行101米右转',\n",
       "         'road': [],\n",
       "         'distance': '101',\n",
       "         'duration': [],\n",
       "         'polyline': '113.679588,23.632492;113.680588,23.632523',\n",
       "         'action': '右转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行199米向右前方行走',\n",
       "         'road': [],\n",
       "         'distance': '199',\n",
       "         'duration': [],\n",
       "         'polyline': '113.680588,23.632523;113.680641,23.632139;113.680672,23.631741;113.680634,23.631540;113.680588,23.631437;113.680496,23.631241;113.680405,23.631094;113.680206,23.630842',\n",
       "         'action': '向右前方行走',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行159米左转',\n",
       "         'road': [],\n",
       "         'distance': '159',\n",
       "         'duration': [],\n",
       "         'polyline': '113.680206,23.630838;113.680038,23.630772;113.679642,23.630638;113.679359,23.630522;113.679199,23.630472;113.679031,23.630430;113.678879,23.630404;113.678711,23.630365',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行237米左转',\n",
       "         'road': [],\n",
       "         'distance': '237',\n",
       "         'duration': [],\n",
       "         'polyline': '113.678711,23.630360;113.678711,23.629341;113.678711,23.629192;113.678688,23.629084;113.678635,23.629023;113.678421,23.628902;113.678368,23.628841;113.678314,23.628723;113.678291,23.628611;113.678276,23.628372',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行498米向右前方行走',\n",
       "         'road': [],\n",
       "         'distance': '498',\n",
       "         'duration': [],\n",
       "         'polyline': '113.678276,23.628368;113.678574,23.628338;113.678688,23.628307;113.678848,23.628233;113.679047,23.628073;113.679161,23.627964;113.679214,23.627869;113.679237,23.627777;113.679283,23.627525;113.679291,23.627321;113.679253,23.626854;113.679184,23.626623;113.679138,23.626497;113.679001,23.626259;113.678940,23.626177;113.678711,23.625977;113.678619,23.625864;113.678528,23.625721;113.678436,23.625191;113.678429,23.625057;113.678452,23.624939;113.678574,23.624657',\n",
       "         'action': '向右前方行走',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行722米左转',\n",
       "         'road': [],\n",
       "         'distance': '722',\n",
       "         'duration': [],\n",
       "         'polyline': '113.678574,23.624653;113.678558,23.624510;113.678413,23.624323;113.677582,23.623793;113.676529,23.623346;113.676361,23.623255;113.676270,23.623152;113.676109,23.622833;113.676041,23.622738;113.675789,23.622482;113.675499,23.622278;113.675415,23.622175;113.675385,23.622087;113.675377,23.621836;113.675392,23.621611;113.675430,23.621475;113.675545,23.621359;113.675766,23.621181;113.675850,23.621090;113.675903,23.620995;113.675903,23.620855;113.675880,23.620726;113.675743,23.620546;113.675598,23.620373;113.675240,23.620012',\n",
       "         'action': '左转',\n",
       "         'assistant_action': []},\n",
       "        {'instruction': '步行41米到达松浪社',\n",
       "         'road': [],\n",
       "         'distance': '41',\n",
       "         'duration': [],\n",
       "         'polyline': '113.675240,23.620008;113.675491,23.620012;113.675644,23.619991;113.675644,23.619991',\n",
       "         'action': [],\n",
       "         'assistant_action': '到达松浪社'}]},\n",
       "      'bus': {'buslines': [{'departure_stop': {'name': '松浪社',\n",
       "          'id': '900000111143034',\n",
       "          'location': '113.675629,23.619987'},\n",
       "         'arrival_stop': {'name': '云星村站',\n",
       "          'id': '900000111143032',\n",
       "          'location': '113.630844,23.610802'},\n",
       "         'name': '从20路(乌土村委总站--从化汽车站总站)',\n",
       "         'id': '900000111143',\n",
       "         'type': '普通公交线路',\n",
       "         'distance': '8998',\n",
       "         'duration': '2653',\n",
       "         'polyline': '113.675629,23.619987;113.675301,23.620045;113.675201,23.619968;113.674934,23.619713;113.673920,23.618620;113.673691,23.618429;113.673454,23.618334;113.673218,23.618269;113.671082,23.617786;113.667892,23.617096;113.666336,23.616735;113.665916,23.616650;113.664551,23.616346;113.663689,23.616152;113.663544,23.616119;113.663223,23.616043;113.662567,23.615911;113.662025,23.615803;113.661682,23.615711;113.660400,23.615417;113.660004,23.615669;113.659927,23.615711;113.659088,23.616234;113.657166,23.617487;113.656975,23.617626;113.656815,23.617783;113.655830,23.618845;113.655678,23.618971;113.655548,23.619076;113.655411,23.619141;113.655281,23.619188;113.655083,23.619236;113.654747,23.619293;113.654518,23.619307;113.654320,23.619303;113.653976,23.619244;113.652885,23.619011;113.652718,23.618984;113.652573,23.618984;113.652428,23.619015;113.651825,23.619240;113.650818,23.619617;113.649361,23.619949;113.648819,23.620077;113.648354,23.620222;113.648087,23.620314;113.647858,23.620438;113.647621,23.620604;113.647377,23.620783;113.647179,23.620893;113.646973,23.620993;113.646477,23.621176;113.646317,23.621258;113.645866,23.621567;113.645721,23.621698;113.645721,23.621876;113.645821,23.622089;113.646248,23.622282;113.646629,23.622496;113.647217,23.622856;113.647697,23.623178;113.648071,23.623466;113.649094,23.624311;113.649666,23.624836;113.649811,23.624950;113.650055,23.625156;113.650192,23.625296;113.652588,23.627287;113.652748,23.627409;113.653603,23.628078;113.654411,23.628637;113.655273,23.629168;113.657509,23.630495;113.657425,23.630590;113.657120,23.630409;113.654335,23.628742;113.653847,23.628416;113.653603,23.628225;113.652382,23.627178;113.650169,23.625324;113.650017,23.625223;113.649773,23.625013;113.649742,23.624990;113.649734,23.624990;113.648926,23.624327;113.647842,23.623442;113.647362,23.623091;113.646782,23.622723;113.646347,23.622465;113.645981,23.622286;113.645592,23.622131;113.645119,23.621990;113.644714,23.621914;113.644516,23.621885;113.644521,23.621890;113.644371,23.621862;113.643257,23.621748;113.642578,23.621666;113.642471,23.621645;113.642029,23.621540;113.641449,23.621353;113.640526,23.621033;113.639336,23.620604;113.639183,23.620543;113.638855,23.620413;113.638474,23.620235;113.636047,23.618944;113.635544,23.618668;113.635254,23.618481;113.634750,23.618097;113.634514,23.617891;113.634254,23.617622;113.633980,23.617271;113.633636,23.616779;113.633057,23.615911;113.632881,23.615646;113.632401,23.614927;113.631912,23.614172;113.631660,23.613710;113.631432,23.613142;113.631287,23.612659;113.630905,23.611076;113.630844,23.610802',\n",
       "         'bustimetag': '2',\n",
       "         'start_time': '0830',\n",
       "         'end_time': '1900',\n",
       "         'via_num': '6',\n",
       "         'via_stops': [{'name': '源湖村五社',\n",
       "           'id': '900000111143035',\n",
       "           'location': '113.663689,23.616152'},\n",
       "          {'name': '源湖村',\n",
       "           'id': '900000111143036',\n",
       "           'location': '113.659927,23.615711'},\n",
       "          {'name': '温泉交警中队',\n",
       "           'id': '900000111143003',\n",
       "           'location': '113.657120,23.630409'},\n",
       "          {'name': '冲口',\n",
       "           'id': '900000111143031',\n",
       "           'location': '113.649742,23.624990'},\n",
       "          {'name': '牛步迳',\n",
       "           'id': '900000111143004',\n",
       "           'location': '113.644516,23.621885'},\n",
       "          {'name': '温泉镇政府',\n",
       "           'id': '900000111143005',\n",
       "           'location': '113.632881,23.615646'}]}]},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}},\n",
       "     {'taxi': [],\n",
       "      'walking': [],\n",
       "      'bus': {'buslines': [{'departure_stop': {'name': '云星村',\n",
       "          'id': '900000111218008',\n",
       "          'location': '113.630844,23.610802'},\n",
       "         'arrival_stop': {'name': '龙岗墟',\n",
       "          'id': '900000111218023',\n",
       "          'location': '113.667899,23.600530'},\n",
       "         'name': '从701路(温泉宾馆--南平村委)',\n",
       "         'id': '900000111218',\n",
       "         'type': '微循环公交',\n",
       "         'distance': '7643',\n",
       "         'duration': '1817',\n",
       "         'polyline': '113.630844,23.610802;113.630844,23.610798;113.630768,23.610516;113.630661,23.610060;113.630569,23.609705;113.630554,23.609617;113.630501,23.609388;113.630119,23.607822;113.629776,23.606388;113.629395,23.604740;113.628891,23.602587;113.628479,23.600821;113.628136,23.599293;113.627968,23.598680;113.627953,23.598633;113.627884,23.598433;113.627785,23.598202;113.627632,23.597919;113.627487,23.597683;113.627281,23.597401;113.627037,23.597139;113.626106,23.596230;113.625641,23.595755;113.624992,23.595139;113.624092,23.594326;113.623161,23.593433;113.622879,23.593147;113.622978,23.593065;113.623573,23.593662;113.627022,23.596935;113.627274,23.597191;113.627449,23.597414;113.627663,23.597729;113.627869,23.598082;113.627975,23.598307;113.628059,23.598547;113.628090,23.598633;113.628212,23.599079;113.628616,23.600807;113.628723,23.601263;113.628720,23.601263;113.628811,23.601658;113.629280,23.601780;113.630113,23.601445;113.630365,23.601354;113.632248,23.600681;113.633785,23.600347;113.635725,23.599957;113.636810,23.599731;113.637335,23.599657;113.638103,23.599596;113.638542,23.599579;113.639266,23.599588;113.639427,23.599592;113.642270,23.599570;113.642578,23.599570;113.643043,23.599622;113.643581,23.599688;113.643624,23.599661;113.643911,23.599657;113.644232,23.599605;113.644449,23.599614;113.645451,23.599935;113.646454,23.600278;113.646589,23.600347;113.646658,23.600417;113.646931,23.600595;113.649835,23.601749;113.649935,23.601797;113.650030,23.601862;113.650937,23.602674;113.651063,23.602752;113.651176,23.602786;113.651367,23.602826;113.651584,23.602847;113.651845,23.602847;113.652001,23.602830;113.652504,23.602708;113.652839,23.602582;113.652999,23.602548;113.653181,23.602543;113.653264,23.602561;113.653659,23.602752;113.653802,23.602799;113.654605,23.602977;113.655122,23.603069;113.655243,23.603077;113.655391,23.603069;113.655799,23.602999;113.656055,23.602934;113.656302,23.602847;113.657083,23.602530;113.657300,23.602461;113.657500,23.602418;113.659041,23.602205;113.659501,23.602144;113.660009,23.602170;113.660386,23.602144;113.661046,23.601988;113.661845,23.601801;113.662044,23.601740;113.662687,23.601458;113.662951,23.601385;113.663980,23.601424;113.664275,23.601445;113.664549,23.601489;113.664596,23.601497;113.664714,23.601497;113.665464,23.601280;113.665655,23.601233;113.665864,23.601202;113.666658,23.601441;113.666662,23.601441;113.666658,23.601441;113.666758,23.601467;113.667001,23.601545;113.667222,23.601615;113.667465,23.601688;113.667773,23.600877;113.667899,23.600530',\n",
       "         'bustimetag': '2',\n",
       "         'start_time': [],\n",
       "         'end_time': [],\n",
       "         'via_num': '3',\n",
       "         'via_stops': [{'name': '宣星路口',\n",
       "           'id': '900000111218009',\n",
       "           'location': '113.628891,23.602587'},\n",
       "          {'name': '宣星路口(星光五金水电商场)',\n",
       "           'id': '900000111218021',\n",
       "           'location': '113.628723,23.601263'},\n",
       "          {'name': '教师村',\n",
       "           'id': '900000111218022',\n",
       "           'location': '113.666658,23.601441'}]}]},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}},\n",
       "     {'taxi': [],\n",
       "      'walking': {'origin': '113.667900,23.600529',\n",
       "       'destination': '113.667816,23.600794',\n",
       "       'distance': '31',\n",
       "       'duration': '26',\n",
       "       'steps': [{'instruction': '沿龙泉路步行31米',\n",
       "         'road': '龙泉路',\n",
       "         'distance': '31',\n",
       "         'duration': [],\n",
       "         'polyline': '113.667900,23.600529;113.667816,23.600794',\n",
       "         'action': [],\n",
       "         'assistant_action': []}]},\n",
       "      'bus': {'buslines': []},\n",
       "      'entrance': [],\n",
       "      'exit': [],\n",
       "      'railway': {'via_stops': [], 'alters': [], 'spaces': []}}]}]}}"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 调用地理编码的函数获取出发点的地理编码\n",
    "origin = \"广东省广州市中山大学南方学院\"\n",
    "中大南方_origin = geocode(key,origin)\n",
    "中大南方_origin['geocodes'][0]['location']\n",
    "print(中大南方_origin['geocodes'][0]['location'])\n",
    "\n",
    "# 调用地理编码的函数获取目的地的地理编码\n",
    "destination = \"广东省广州市从化区龙岗\"\n",
    "龙岗_destination = geocode(key,destination)\n",
    "龙岗_destination['geocodes'][0]['location']\n",
    "print(龙岗_destination['geocodes'][0]['location'])\n",
    "\n",
    "# 调用公交规划路径的函数\n",
    "city = \"广州\"\n",
    "公交_plan = bus(key,中大南方_origin['geocodes'][0]['location'],龙岗_destination['geocodes'][0]['location'],city)\n",
    "公交_plan"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 驾车路径\n",
    "* 1、规划以小客车、轿车通勤出行的方案，并且返回通勤方案的数据。  \n",
    "\n",
    "* 2、URL：https://restapi.amap.com/v3/direction/driving?parameters \n",
    "\n",
    "* 3、请求方式：requests.get()  \n",
    "\n",
    "* 4、请求参数（parameters）：\n",
    "> * ①.必选：key（高德API密钥）、origin（出发点：**经纬度**）、destination（目的地：**经纬度**）、extensions（返回结果控制：base / all）\n",
    "> * ②.可选：originid（出发点poiid）、destinationid（目的地poiid）、origintype（起点的poi类别）、destinationtype（终点的poi类别）、strategy（驾车选择策略：0-9 只返回一条路径规划结果  10-20 返回多条路径规划结果）、waypoints（途经点）、avoidpolygons（避让区域）、avoidroad（避让道路名）、province（用汉字填入车牌省份缩写，用于判断是否限行）、number（填入除省份及标点之外，车牌的字母和数字（需大写），用于判断限行相关）、cartype（车辆类型：0 1 2）、ferry （在路径规划中，是否使用轮渡 0：默认值 使用  1：不使用）、roadaggregation（是否返回路径聚合信息 false：不返回  true：返回）、nosteps（是否返回steps字段内容）、sig（数字签名）、callback（回调函数）、output（返回数据格式类型：json）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 调用geo.py文件中的drive和geocode模块\n",
    "from geo import drive,geocode"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "113.679287,23.632575\n",
      "113.668051,23.600869\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'count': '1',\n",
       " 'route': {'origin': '113.679287,23.632575',\n",
       "  'destination': '113.668051,23.600869',\n",
       "  'taxi_cost': '17',\n",
       "  'paths': [{'distance': '5576',\n",
       "    'duration': '836',\n",
       "    'strategy': '速度最快',\n",
       "    'tolls': '0',\n",
       "    'toll_distance': '0',\n",
       "    'steps': [{'instruction': '向南行驶9米左转',\n",
       "      'orientation': '南',\n",
       "      'distance': '9',\n",
       "      'tolls': '0',\n",
       "      'toll_distance': '0',\n",
       "      'toll_road': [],\n",
       "      'duration': '6',\n",
       "      'polyline': '113.679596,23.632574;113.679596,23.632491',\n",
       "      'action': '左转',\n",
       "      'assistant_action': [],\n",
       "      'tmcs': [{'lcode': [],\n",
       "        'distance': '9',\n",
       "        'status': '未知',\n",
       "        'polyline': '113.679596,23.632574;113.679596,23.632491'}],\n",
       "      'cities': [{'name': '广州市',\n",
       "        'citycode': '020',\n",
       "        'adcode': '440100',\n",
       "        'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       "     {'instruction': '向东行驶100米右转',\n",
       "      'orientation': '东',\n",
       "      'distance': '100',\n",
       "      'tolls': '0',\n",
       "      'toll_distance': '0',\n",
       "      'toll_road': [],\n",
       "      'duration': '30',\n",
       "      'polyline': '113.679596,23.632491;113.680582,23.632522',\n",
       "      'action': '右转',\n",
       "      'assistant_action': [],\n",
       "      'tmcs': [{'lcode': [],\n",
       "        'distance': '100',\n",
       "        'status': '未知',\n",
       "        'polyline': '113.679596,23.632491;113.680582,23.632522'}],\n",
       "      'cities': [{'name': '广州市',\n",
       "        'citycode': '020',\n",
       "        'adcode': '440100',\n",
       "        'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       "     {'instruction': '向南行驶199米向右前方行驶',\n",
       "      'orientation': '南',\n",
       "      'distance': '199',\n",
       "      'tolls': '0',\n",
       "      'toll_distance': '0',\n",
       "      'toll_road': [],\n",
       "      'duration': '51',\n",
       "      'polyline': '113.680582,23.632522;113.680642,23.632135;113.680668,23.631736;113.680642,23.631589;113.680629,23.631536;113.68059,23.631432;113.680499,23.631237;113.680399,23.631089;113.680204,23.630838',\n",
       "      'action': '向右前方行驶',\n",
       "      'assistant_action': [],\n",
       "      'tmcs': [{'lcode': [],\n",
       "        'distance': '122',\n",
       "        'status': '未知',\n",
       "        'polyline': '113.680582,23.632522;113.680642,23.632135;113.680668,23.631736;113.680642,23.631589;113.680629,23.631536;113.68059,23.631432'},\n",
       "       {'lcode': [],\n",
       "        'distance': '77',\n",
       "        'status': '未知',\n",
       "        'polyline': '113.68059,23.631432;113.680499,23.631237;113.680399,23.631089;113.680204,23.630838'}],\n",
       "      'cities': [{'name': '广州市',\n",
       "        'citycode': '020',\n",
       "        'adcode': '440100',\n",
       "        'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       "     {'instruction': '向西行驶159米左转',\n",
       "      'orientation': '西',\n",
       "      'distance': '159',\n",
       "      'tolls': '0',\n",
       "      'toll_distance': '0',\n",
       "      'toll_road': [],\n",
       "      'duration': '35',\n",
       "      'polyline': '113.680204,23.630838;113.68003,23.630768;113.67964,23.630634;113.679358,23.630516;113.679197,23.630469;113.678711,23.63036',\n",
       "      'action': '左转',\n",
       "      'assistant_action': [],\n",
       "      'tmcs': [{'lcode': [],\n",
       "        'distance': '18',\n",
       "        'status': '未知',\n",
       "        'polyline': '113.680204,23.630838;113.68003,23.630768'},\n",
       "       {'lcode': [],\n",
       "        'distance': '42',\n",
       "        'status': '未知',\n",
       "        'polyline': '113.68003,23.630768;113.67964,23.630634'},\n",
       "       {'lcode': [],\n",
       "        'distance': '48',\n",
       "        'status': '未知',\n",
       "        'polyline': '113.67964,23.630634;113.679358,23.630516;113.679197,23.630469'},\n",
       "       {'lcode': [],\n",
       "        'distance': '51',\n",
       "        'status': '未知',\n",
       "        'polyline': '113.679197,23.630469;113.678711,23.63036'}],\n",
       "      'cities': [{'name': '广州市',\n",
       "        'citycode': '020',\n",
       "        'adcode': '440100',\n",
       "        'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       "     {'instruction': '向南行驶237米左转',\n",
       "      'orientation': '南',\n",
       "      'distance': '237',\n",
       "      'tolls': '0',\n",
       "      'toll_distance': '0',\n",
       "      'toll_road': [],\n",
       "      'duration': '66',\n",
       "      'polyline': '113.678711,23.63036;113.678711,23.629336;113.678698,23.629128;113.678663,23.629054;113.678572,23.628984;113.67842,23.628898;113.678364,23.628837;113.678325,23.628772;113.678299,23.628646;113.678273,23.628372',\n",
       "      'action': '左转',\n",
       "      'assistant_action': [],\n",
       "      'tmcs': [{'lcode': [],\n",
       "        'distance': '113',\n",
       "        'status': '未知',\n",
       "        'polyline': '113.678711,23.63036;113.678711,23.629336'},\n",
       "       {'lcode': [],\n",
       "        'distance': '124',\n",
       "        'status': '未知',\n",
       "        'polyline': '113.678711,23.629336;113.678698,23.629128;113.678663,23.629054;113.678572,23.628984;113.67842,23.628898;113.678364,23.628837;113.678325,23.628772;113.678299,23.628646;113.678273,23.628372'}],\n",
       "      'cities': [{'name': '广州市',\n",
       "        'citycode': '020',\n",
       "        'adcode': '440100',\n",
       "        'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       "     {'instruction': '向东南行驶105米向右前方行驶',\n",
       "      'orientation': '东南',\n",
       "      'distance': '105',\n",
       "      'tolls': '0',\n",
       "      'toll_distance': '0',\n",
       "      'toll_road': [],\n",
       "      'duration': '48',\n",
       "      'polyline': '113.678273,23.628372;113.678572,23.628333;113.678689,23.628303;113.678845,23.628234;113.679045,23.628069;113.679162,23.62796',\n",
       "      'action': '向右前方行驶',\n",
       "      'assistant_action': [],\n",
       "      'tmcs': [{'lcode': [],\n",
       "        'distance': '43',\n",
       "        'status': '未知',\n",
       "        'polyline': '113.678273,23.628372;113.678572,23.628333;113.678689,23.628303'},\n",
       "       {'lcode': [],\n",
       "        'distance': '62',\n",
       "        'status': '未知',\n",
       "        'polyline': '113.678689,23.628303;113.678845,23.628234;113.679045,23.628069;113.679162,23.62796'}],\n",
       "      'cities': [{'name': '广州市',\n",
       "        'citycode': '020',\n",
       "        'adcode': '440100',\n",
       "        'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       "     {'instruction': '向南行驶393米向右前方行驶',\n",
       "      'orientation': '南',\n",
       "      'distance': '393',\n",
       "      'tolls': '0',\n",
       "      'toll_distance': '0',\n",
       "      'toll_road': [],\n",
       "      'duration': '65',\n",
       "      'polyline': '113.679162,23.62796;113.679214,23.627865;113.679236,23.627773;113.67928,23.627522;113.679288,23.627318;113.679249,23.626849;113.679184,23.626619;113.679136,23.626493;113.679002,23.62625;113.678937,23.626172;113.678707,23.625972;113.678615,23.625859;113.678529,23.625716;113.678507,23.625634;113.678433,23.625187;113.678424,23.625052;113.678455,23.624931;113.678572,23.624653',\n",
       "      'action': '向右前方行驶',\n",
       "      'assistant_action': [],\n",
       "      'tmcs': [{'lcode': [],\n",
       "        'distance': '72',\n",
       "        'status': '未知',\n",
       "        'polyline': '113.679162,23.62796;113.679214,23.627865;113.679236,23.627773;113.67928,23.627522;113.679288,23.627318'},\n",
       "       {'lcode': [],\n",
       "        'distance': '321',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.679288,23.627318;113.679249,23.626849;113.679184,23.626619;113.679136,23.626493;113.679002,23.62625;113.678937,23.626172;113.678707,23.625972;113.678615,23.625859;113.678529,23.625716;113.678507,23.625634;113.678433,23.625187;113.678424,23.625052;113.678455,23.624931;113.678572,23.624653'}],\n",
       "      'cities': [{'name': '广州市',\n",
       "        'citycode': '020',\n",
       "        'adcode': '440100',\n",
       "        'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       "     {'instruction': '沿源富街途径源湖街向西南行驶2.4千米左转',\n",
       "      'orientation': '西南',\n",
       "      'road': '源富街',\n",
       "      'distance': '2351',\n",
       "      'tolls': '0',\n",
       "      'toll_distance': '0',\n",
       "      'toll_road': [],\n",
       "      'duration': '286',\n",
       "      'polyline': '113.678572,23.624653;113.678555,23.624505;113.678411,23.624323;113.677578,23.623789;113.676528,23.623346;113.676354,23.623247;113.676263,23.623147;113.676102,23.62283;113.676037,23.622734;113.675786,23.622474;113.675499,23.62227;113.675412,23.62217;113.675378,23.622083;113.675373,23.621832;113.675391,23.621606;113.675438,23.621471;113.675538,23.621354;113.675764,23.621176;113.675851,23.621085;113.675898,23.62099;113.675911,23.620851;113.675868,23.62072;113.675786,23.620603;113.675742,23.620543;113.675595,23.620369;113.675239,23.620009;113.674931,23.619714;113.673919,23.61862;113.673689,23.618429;113.673459,23.618333;113.673216,23.618268;113.671081,23.617786;113.667895,23.617096;113.666341,23.616736;113.665916,23.616649;113.664549,23.616345;113.663585,23.616128;113.663507,23.616107;113.663225,23.616042;113.662569,23.615911;113.662027,23.615803;113.661684,23.615712;113.660404,23.615417',\n",
       "      'action': '左转',\n",
       "      'assistant_action': [],\n",
       "      'tmcs': [{'lcode': [],\n",
       "        'distance': '42',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.678572,23.624653;113.678555,23.624505;113.678411,23.624323'},\n",
       "       {'lcode': [],\n",
       "        'distance': '435',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.678411,23.624323;113.677578,23.623789;113.676528,23.623346;113.676354,23.623247;113.676263,23.623147;113.676102,23.62283;113.676037,23.622734;113.675786,23.622474;113.675499,23.62227;113.675412,23.62217;113.675378,23.622083;113.675373,23.621832'},\n",
       "       {'lcode': [],\n",
       "        'distance': '245',\n",
       "        'status': '未知',\n",
       "        'polyline': '113.675373,23.621832;113.675391,23.621606;113.675438,23.621471;113.675538,23.621354;113.675764,23.621176;113.675851,23.621085;113.675898,23.62099;113.675911,23.620851;113.675868,23.62072;113.675786,23.620603;113.675742,23.620543;113.675595,23.620369;113.675239,23.620009'},\n",
       "       {'lcode': [],\n",
       "        'distance': '512',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.675239,23.620009;113.674931,23.619714;113.673919,23.61862;113.673689,23.618429;113.673459,23.618333;113.673216,23.618268;113.671081,23.617786'},\n",
       "       {'lcode': [],\n",
       "        'distance': '334',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.671081,23.617786;113.667895,23.617096'},\n",
       "       {'lcode': [],\n",
       "        'distance': '163',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.667895,23.617096;113.666341,23.616736'},\n",
       "       {'lcode': [],\n",
       "        'distance': '44',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.666341,23.616736;113.665916,23.616649'},\n",
       "       {'lcode': [],\n",
       "        'distance': '244',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.665916,23.616649;113.664549,23.616345;113.663585,23.616128'},\n",
       "       {'lcode': [],\n",
       "        'distance': '8',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.663585,23.616128;113.663507,23.616107'},\n",
       "       {'lcode': [],\n",
       "        'distance': '29',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.663507,23.616107;113.663225,23.616042'},\n",
       "       {'lcode': [],\n",
       "        'distance': '68',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.663225,23.616042;113.662569,23.615911'},\n",
       "       {'lcode': [],\n",
       "        'distance': '93',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.662569,23.615911;113.662027,23.615803;113.661684,23.615712'},\n",
       "       {'lcode': [],\n",
       "        'distance': '134',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.661684,23.615712;113.660404,23.615417'}],\n",
       "      'cities': [{'name': '广州市',\n",
       "        'citycode': '020',\n",
       "        'adcode': '440100',\n",
       "        'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       "     {'instruction': '沿龙泉路向东南行驶1.9千米左转',\n",
       "      'orientation': '东南',\n",
       "      'road': '龙泉路',\n",
       "      'distance': '1858',\n",
       "      'tolls': '0',\n",
       "      'toll_distance': '0',\n",
       "      'toll_road': [],\n",
       "      'duration': '190',\n",
       "      'polyline': '113.660404,23.615417;113.660872,23.61513;113.661315,23.614831;113.661619,23.614596;113.661667,23.614527;113.661736,23.614349;113.661797,23.614145;113.661862,23.614006;113.661914,23.613937;113.662079,23.613789;113.662613,23.613381;113.662756,23.61322;113.662804,23.613142;113.66434,23.609618;113.664549,23.609128;113.665095,23.607891;113.665694,23.606523;113.667018,23.602865;113.667179,23.602465;113.667361,23.601984;113.667465,23.601688;113.667565,23.601437;113.667665,23.601159;113.667773,23.600877;113.667943,23.600412',\n",
       "      'action': '左转',\n",
       "      'assistant_action': [],\n",
       "      'tmcs': [{'lcode': [],\n",
       "        'distance': '113',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.660404,23.615417;113.660872,23.61513;113.661315,23.614831'},\n",
       "       {'lcode': [],\n",
       "        'distance': '70',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.661315,23.614831;113.661619,23.614596;113.661667,23.614527;113.661736,23.614349'},\n",
       "       {'lcode': [],\n",
       "        'distance': '23',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.661736,23.614349;113.661797,23.614145'},\n",
       "       {'lcode': [],\n",
       "        'distance': '153',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.661797,23.614145;113.661862,23.614006;113.661914,23.613937;113.662079,23.613789;113.662613,23.613381;113.662756,23.61322;113.662804,23.613142'},\n",
       "       {'lcode': [],\n",
       "        'distance': '626',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.662804,23.613142;113.66434,23.609618;113.664549,23.609128;113.665095,23.607891'},\n",
       "       {'lcode': [],\n",
       "        'distance': '163',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.665095,23.607891;113.665694,23.606523'},\n",
       "       {'lcode': [],\n",
       "        'distance': '426',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.665694,23.606523;113.667018,23.602865'},\n",
       "       {'lcode': [],\n",
       "        'distance': '47',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.667018,23.602865;113.667179,23.602465'},\n",
       "       {'lcode': [],\n",
       "        'distance': '56',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.667179,23.602465;113.667361,23.601984'},\n",
       "       {'lcode': [],\n",
       "        'distance': '34',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.667361,23.601984;113.667465,23.601688'},\n",
       "       {'lcode': [],\n",
       "        'distance': '29',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.667465,23.601688;113.667565,23.601437'},\n",
       "       {'lcode': [],\n",
       "        'distance': '32',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.667565,23.601437;113.667665,23.601159'},\n",
       "       {'lcode': [],\n",
       "        'distance': '32',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.667665,23.601159;113.667773,23.600877'},\n",
       "       {'lcode': [],\n",
       "        'distance': '54',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.667773,23.600877;113.667943,23.600412'}],\n",
       "      'cities': [{'name': '广州市',\n",
       "        'citycode': '020',\n",
       "        'adcode': '440100',\n",
       "        'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       "     {'instruction': '沿桃园东路向东北行驶82米左转',\n",
       "      'orientation': '东北',\n",
       "      'road': '桃园东路',\n",
       "      'distance': '82',\n",
       "      'tolls': '0',\n",
       "      'toll_distance': '0',\n",
       "      'toll_road': [],\n",
       "      'duration': '16',\n",
       "      'polyline': '113.667943,23.600412;113.668437,23.600642;113.668663,23.600764',\n",
       "      'action': '左转',\n",
       "      'assistant_action': [],\n",
       "      'tmcs': [{'lcode': [],\n",
       "        'distance': '82',\n",
       "        'status': '畅通',\n",
       "        'polyline': '113.667943,23.600412;113.668437,23.600642;113.668663,23.600764'}],\n",
       "      'cities': [{'name': '广州市',\n",
       "        'citycode': '020',\n",
       "        'adcode': '440100',\n",
       "        'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       "     {'instruction': '沿龙岗福安街向西北行驶48米左转',\n",
       "      'orientation': '西北',\n",
       "      'road': '龙岗福安街',\n",
       "      'distance': '48',\n",
       "      'tolls': '0',\n",
       "      'toll_distance': '0',\n",
       "      'toll_road': [],\n",
       "      'duration': '30',\n",
       "      'polyline': '113.668663,23.600764;113.668451,23.601003;113.668398,23.60112',\n",
       "      'action': '左转',\n",
       "      'assistant_action': [],\n",
       "      'tmcs': [{'lcode': [],\n",
       "        'distance': '48',\n",
       "        'status': '未知',\n",
       "        'polyline': '113.668663,23.600764;113.668451,23.601003;113.668398,23.60112'}],\n",
       "      'cities': [{'name': '广州市',\n",
       "        'citycode': '020',\n",
       "        'adcode': '440100',\n",
       "        'districts': [{'name': '从化区', 'adcode': '440117'}]}]},\n",
       "     {'instruction': '向西行驶35米到达目的地',\n",
       "      'orientation': '西',\n",
       "      'distance': '35',\n",
       "      'tolls': '0',\n",
       "      'toll_distance': '0',\n",
       "      'toll_road': [],\n",
       "      'duration': '13',\n",
       "      'polyline': '113.668398,23.60112;113.668325,23.601094;113.668095,23.601011;113.668077,23.601016',\n",
       "      'action': [],\n",
       "      'assistant_action': '到达目的地',\n",
       "      'tmcs': [{'lcode': [],\n",
       "        'distance': '8',\n",
       "        'status': '未知',\n",
       "        'polyline': '113.668398,23.60112;113.668325,23.601094'},\n",
       "       {'lcode': [],\n",
       "        'distance': '27',\n",
       "        'status': '未知',\n",
       "        'polyline': '113.668325,23.601094;113.668095,23.601011;113.668077,23.601016'}],\n",
       "      'cities': [{'name': '广州市',\n",
       "        'citycode': '020',\n",
       "        'adcode': '440100',\n",
       "        'districts': [{'name': '从化区', 'adcode': '440117'}]}]}],\n",
       "    'restriction': '0',\n",
       "    'traffic_lights': '0'}]}}"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 调用地理编码的函数获取出发点的地理编码\n",
    "origin = \"广东省广州市中山大学南方学院\"\n",
    "中大南方_origin = geocode(key,origin)\n",
    "中大南方_origin['geocodes'][0]['location']\n",
    "print(中大南方_origin['geocodes'][0]['location'])\n",
    "\n",
    "# 调用地理编码的函数获取目的地的地理编码\n",
    "destination = \"广东省广州市从化区龙岗\"\n",
    "龙岗_destination = geocode(key,destination)\n",
    "龙岗_destination['geocodes'][0]['location']\n",
    "print(龙岗_destination['geocodes'][0]['location'])\n",
    "\n",
    "# 调用驾车规划路径的函数\n",
    "驾车_plan = drive(key,中大南方_origin['geocodes'][0]['location'],龙岗_destination['geocodes'][0]['location'],extensions)\n",
    "驾车_plan"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 骑行路径\n",
    "* 1、规划骑行通勤方案，规划时不会考虑路况；考虑天桥、单行线、封路等情况。  \n",
    "\n",
    "* 2、URL：https://restapi.amap.com/v4/direction/bicycling?parameters \n",
    "\n",
    "* 3、请求方式：requests.get()  \n",
    "\n",
    "* 4、请求参数（parameters）：\n",
    "> * ①.必选：key（高德API密钥）、origin（出发点：**经纬度**）、destination（目的地：**经纬度**）\n",
    "> * ②.可选：无"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 调用geo.py文件中的cycle和geocode模块\n",
    "from geo import cycle,geocode"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "113.679287,23.632575\n",
      "113.668051,23.600869\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'data': {'destination': '113.668051,23.600869',\n",
       "  'origin': '113.679287,23.632575',\n",
       "  'paths': [{'distance': 4957,\n",
       "    'duration': 1190,\n",
       "    'steps': [{'action': '右转',\n",
       "      'assistant_action': '',\n",
       "      'distance': 101,\n",
       "      'duration': 24,\n",
       "      'instruction': '向东骑行101米右转',\n",
       "      'orientation': '东',\n",
       "      'polyline': '113.679592,23.632491;113.680586,23.632522',\n",
       "      'road': '',\n",
       "      'walk_type': 0},\n",
       "     {'action': '向右前方行驶',\n",
       "      'assistant_action': '',\n",
       "      'distance': 199,\n",
       "      'duration': 48,\n",
       "      'instruction': '向南骑行199米向右前方行驶',\n",
       "      'orientation': '南',\n",
       "      'polyline': '113.680586,23.632522;113.680638,23.63214;113.680668,23.63174;113.680634,23.631541;113.68059,23.631437;113.68059,23.631437;113.680499,23.631241;113.680408,23.631094;113.680208,23.630842',\n",
       "      'road': '',\n",
       "      'walk_type': 0},\n",
       "     {'action': '左转',\n",
       "      'assistant_action': '',\n",
       "      'distance': 159,\n",
       "      'duration': 38,\n",
       "      'instruction': '向西骑行159米左转',\n",
       "      'orientation': '西',\n",
       "      'polyline': '113.680204,23.630838;113.680035,23.630773;113.680035,23.630773;113.679644,23.630638;113.679644,23.630638;113.679362,23.630521;113.679201,23.630473;113.679201,23.630473;113.679032,23.63043;113.679032,23.63043;113.67888,23.630404;113.67888,23.630404;113.678711,23.630365',\n",
       "      'road': '',\n",
       "      'walk_type': 0},\n",
       "     {'action': '左转',\n",
       "      'assistant_action': '',\n",
       "      'distance': 237,\n",
       "      'duration': 57,\n",
       "      'instruction': '向南骑行237米左转',\n",
       "      'orientation': '南',\n",
       "      'polyline': '113.678711,23.63036;113.678711,23.62934;113.678711,23.62934;113.678711,23.629193;113.678689,23.629084;113.678637,23.629023;113.678424,23.628902;113.678368,23.628841;113.678316,23.628724;113.678294,23.628611;113.678294,23.628611;113.678277,23.628372',\n",
       "      'road': '',\n",
       "      'walk_type': 0},\n",
       "     {'action': '向右前方行驶',\n",
       "      'assistant_action': '',\n",
       "      'distance': 498,\n",
       "      'duration': 120,\n",
       "      'instruction': '向南骑行498米向右前方行驶',\n",
       "      'orientation': '南',\n",
       "      'polyline': '113.678273,23.628368;113.678572,23.628338;113.678685,23.628307;113.678685,23.628307;113.678845,23.628234;113.679045,23.628073;113.679158,23.627964;113.679158,23.627964;113.679214,23.627869;113.679236,23.627778;113.67928,23.627526;113.679288,23.627322;113.679288,23.627322;113.679253,23.626853;113.679184,23.626623;113.679141,23.626497;113.679002,23.626259;113.678941,23.626176;113.678711,23.625977;113.67862,23.625864;113.678529,23.62572;113.678438,23.625191;113.678429,23.625056;113.678451,23.624939;113.678572,23.624657',\n",
       "      'road': '',\n",
       "      'walk_type': 0},\n",
       "     {'action': '左转',\n",
       "      'assistant_action': '',\n",
       "      'distance': 722,\n",
       "      'duration': 173,\n",
       "      'instruction': '向西南骑行722米左转',\n",
       "      'orientation': '西南',\n",
       "      'polyline': '113.678572,23.624653;113.678559,23.62451;113.678416,23.624323;113.678416,23.624323;113.677582,23.623793;113.676532,23.623346;113.676363,23.623255;113.676272,23.623151;113.676111,23.622834;113.676042,23.622739;113.67579,23.622483;113.675499,23.622279;113.675417,23.622174;113.675386,23.622088;113.675378,23.621836;113.675378,23.621836;113.675391,23.62161;113.675434,23.621476;113.675543,23.621359;113.675764,23.621181;113.675846,23.621089;113.675903,23.620994;113.675907,23.620855;113.675877,23.620725;113.675747,23.620547;113.675599,23.620373;113.675243,23.620013',\n",
       "      'road': '',\n",
       "      'walk_type': 0},\n",
       "     {'action': '向右前方行驶',\n",
       "      'assistant_action': '',\n",
       "      'distance': 412,\n",
       "      'duration': 99,\n",
       "      'instruction': '向东南骑行412米向右前方行驶',\n",
       "      'orientation': '东南',\n",
       "      'polyline': '113.675239,23.620009;113.67549,23.620013;113.675642,23.619991;113.675773,23.619948;113.676016,23.619796;113.676901,23.619193;113.677261,23.618785;113.678069,23.61783;113.678069,23.61783;113.678181,23.617656',\n",
       "      'road': '',\n",
       "      'walk_type': 0},\n",
       "     {'action': '右转',\n",
       "      'assistant_action': '',\n",
       "      'distance': 1381,\n",
       "      'duration': 331,\n",
       "      'instruction': '沿乌土街向南骑行1381米右转',\n",
       "      'orientation': '南',\n",
       "      'polyline': '113.678181,23.617652;113.678095,23.617205;113.678051,23.617075;113.677973,23.616923;113.677743,23.616558;113.677609,23.616289;113.677391,23.615816;113.677339,23.615668;113.67714,23.614826;113.677049,23.614323;113.676927,23.613359;113.676845,23.612786;113.676602,23.611489;113.676415,23.610438;113.676411,23.610265;113.676411,23.610265;113.676489,23.609848;113.676502,23.609622;113.676493,23.609236;113.676415,23.608746;113.676415,23.608485;113.67648,23.60819;113.67661,23.607734;113.676819,23.606736;113.676862,23.606541;113.676914,23.606415;113.677014,23.606254;113.677535,23.605673',\n",
       "      'road': '乌土街',\n",
       "      'walk_type': 0},\n",
       "     {'action': '直行',\n",
       "      'assistant_action': '',\n",
       "      'distance': 165,\n",
       "      'duration': 40,\n",
       "      'instruction': '沿乌土街向西南骑行165米直行',\n",
       "      'orientation': '西南',\n",
       "      'polyline': '113.677535,23.605668;113.676988,23.605373;113.676402,23.605;113.676163,23.604887',\n",
       "      'road': '乌土街',\n",
       "      'walk_type': 0},\n",
       "     {'action': '直行',\n",
       "      'assistant_action': '',\n",
       "      'distance': 118,\n",
       "      'duration': 28,\n",
       "      'instruction': '沿934县道向西骑行118米直行',\n",
       "      'orientation': '西',\n",
       "      'polyline': '113.676159,23.604883;113.675799,23.604805;113.675508,23.604779;113.675508,23.604779;113.675013,23.60474',\n",
       "      'road': '934县道',\n",
       "      'walk_type': 0},\n",
       "     {'action': '向右前方行驶',\n",
       "      'assistant_action': '',\n",
       "      'distance': 674,\n",
       "      'duration': 162,\n",
       "      'instruction': '沿桃园东路向西南骑行674米向右前方行驶',\n",
       "      'orientation': '西南',\n",
       "      'polyline': '113.675009,23.604735;113.674236,23.604683;113.673893,23.604618;113.673464,23.604492;113.673464,23.604492;113.67168,23.604006;113.671541,23.603958;113.671411,23.603854;113.671068,23.603472;113.670807,23.603264;113.670807,23.603264;113.670525,23.603073;113.6702,23.602904;113.6702,23.602904;113.670022,23.602795;113.670022,23.602795;113.669909,23.602682;113.669818,23.602517;113.669787,23.602413;113.669718,23.601901',\n",
       "      'road': '桃园东路',\n",
       "      'walk_type': 0},\n",
       "     {'action': '右转',\n",
       "      'assistant_action': '',\n",
       "      'distance': 247,\n",
       "      'duration': 59,\n",
       "      'instruction': '沿桃园东路向西南骑行247米右转',\n",
       "      'orientation': '西南',\n",
       "      'polyline': '113.669714,23.601897;113.66964,23.601771;113.66964,23.601771;113.669488,23.601558;113.669488,23.601558;113.668789,23.600859;113.668663,23.600768;113.668663,23.600768;113.668442,23.600647;113.667947,23.600417',\n",
       "      'road': '桃园东路',\n",
       "      'walk_type': 0},\n",
       "     {'action': '',\n",
       "      'assistant_action': '到达目的地',\n",
       "      'distance': 44,\n",
       "      'duration': 11,\n",
       "      'instruction': '沿龙泉路向北骑行44米到达目的地',\n",
       "      'orientation': '北',\n",
       "      'polyline': '113.667943,23.600412;113.667812,23.600794',\n",
       "      'road': '龙泉路',\n",
       "      'walk_type': 0}]}]},\n",
       " 'errcode': 0,\n",
       " 'errdetail': None,\n",
       " 'errmsg': 'OK',\n",
       " 'ext': None}"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 调用地理编码的函数获取出发点的地理编码\n",
    "origin = \"广东省广州市中山大学南方学院\"\n",
    "中大南方_origin = geocode(key,origin)\n",
    "中大南方_origin['geocodes'][0]['location']\n",
    "print(中大南方_origin['geocodes'][0]['location'])\n",
    "\n",
    "# 调用地理编码的函数获取目的地的地理编码\n",
    "destination = \"广东省广州市从化区龙岗\"\n",
    "龙岗_destination = geocode(key,destination)\n",
    "龙岗_destination['geocodes'][0]['location']\n",
    "print(龙岗_destination['geocodes'][0]['location'])\n",
    "\n",
    "# 调用驾车规划路径的函数\n",
    "骑行_plan = cycle(key,中大南方_origin['geocodes'][0]['location'],龙岗_destination['geocodes'][0]['location'])\n",
    "骑行_plan"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 行政区域查询\n",
    "\n",
    "* 1、根据用户输入的搜索条件可以帮助用户快速的查找特定的行政区域信息。  \n",
    "\n",
    "* 2、URL：https://restapi.amap.com/v3/config/district?parameters  \n",
    "\n",
    "* 3、请求方式：requests.get()  \n",
    "\n",
    "* 4、请求参数（parameters）：\n",
    "> * ①.必选：key（高德API密钥）\n",
    "> * ②.可选：keywords（查询关键字）、subdistrict（子级行政区：0 1 2 3）、page（需要第几页数据）、offset（最外层返回数据个数）、extensions（返回结果控制：base / all）、filter（根据区划过滤）、callback（回调函数）、output（返回数据格式类型：json / XML）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 调用geo.py文件中的行政区域查询模块\n",
    "from geo import district"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'count': '1',\n",
       " 'suggestion': {'keywords': [], 'cities': []},\n",
       " 'districts': [{'citycode': '0757',\n",
       "   'adcode': '440600',\n",
       "   'name': '佛山市',\n",
       "   'center': '113.122717,23.028762',\n",
       "   'level': 'city',\n",
       "   'districts': [{'citycode': '0757',\n",
       "     'adcode': '440607',\n",
       "     'name': '三水区',\n",
       "     'center': '112.899414,23.16504',\n",
       "     'level': 'district',\n",
       "     'districts': []},\n",
       "    {'citycode': '0757',\n",
       "     'adcode': '440608',\n",
       "     'name': '高明区',\n",
       "     'center': '112.882123,22.893855',\n",
       "     'level': 'district',\n",
       "     'districts': []},\n",
       "    {'citycode': '0757',\n",
       "     'adcode': '440606',\n",
       "     'name': '顺德区',\n",
       "     'center': '113.281826,22.75851',\n",
       "     'level': 'district',\n",
       "     'districts': []},\n",
       "    {'citycode': '0757',\n",
       "     'adcode': '440605',\n",
       "     'name': '南海区',\n",
       "     'center': '113.145577,23.031562',\n",
       "     'level': 'district',\n",
       "     'districts': []},\n",
       "    {'citycode': '0757',\n",
       "     'adcode': '440604',\n",
       "     'name': '禅城区',\n",
       "     'center': '113.112414,23.019643',\n",
       "     'level': 'district',\n",
       "     'districts': []}]}]}"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "佛山_区域查询 = district(key,\"佛山\",\"0\")\n",
    "佛山_区域查询"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 搜索POI\n",
    "\n",
    "* 1、提供多种查询POI信息的能力，其中包括关键字搜索、周边搜索、多边形搜索、ID查询四种筛选机制。  \n",
    "\n",
    "* 2、URL：（具体见下方） \n",
    "\n",
    "* 3、请求方式：requests.get()  \n",
    "\n",
    "* 4、请求参数（parameters）：\n",
    "> * ①.必选：（具体见下方）\n",
    "> * ②.可选：（具体见下方）"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 关键字搜索\n",
    "* 1、URL：https://restapi.amap.com/v3/place/text?parameters\n",
    "\n",
    "* 2、请求方式：requests.get()  \n",
    "\n",
    "* 3、请求参数（parameters）：\n",
    "> * ①.必选：key（高德API密钥）、keywords（查询关键字：多个关键字用“|”分割）、types（查询POI类型）、\n",
    "> * ②.可选：city（查询城市：可选值：城市中文、中文全拼、citycode、adcode）、citylimit（仅返回指定城市数据：true / false）、children（是否按照层级展示子POI数据）、offset（每页记录数据：不超过25）、page（当前页数：最大翻页数为100）、extensions（返回结果控制：base / all）、sig（数字签名）、callback（回调函数）、output（返回数据格式类型：json）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 调用geo.py文件中的关键字搜索模块\n",
    "from geo import poi_keywords"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'suggestion': {'keywords': [], 'cities': []},\n",
       " 'count': '900',\n",
       " 'infocode': '10000',\n",
       " 'pois': [{'parent': [],\n",
       "   'address': '杨和镇人杰路清泰村',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'cityname': '佛山市',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'photos': [],\n",
       "   'typecode': '050100',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '高明区',\n",
       "   'name': '园林美食城',\n",
       "   'location': '112.789768,22.863607',\n",
       "   'tel': [],\n",
       "   'shopid': [],\n",
       "   'id': 'B02F507SNY'},\n",
       "  {'parent': [],\n",
       "   'address': '季华四路33号创意产业园16号楼101室',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'cityname': '佛山市',\n",
       "   'type': '餐饮服务;中餐厅;火锅店',\n",
       "   'photos': [],\n",
       "   'typecode': '050117',\n",
       "   'shopinfo': '1',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '禅城区',\n",
       "   'name': '海底捞火锅(创意园店)',\n",
       "   'location': '113.098161,23.013120',\n",
       "   'tel': '0757-82783098;0757-82783099',\n",
       "   'shopid': [],\n",
       "   'id': 'B0FFHGGEPH'},\n",
       "  {'parent': 'B0FFFPZ0AB',\n",
       "   'address': '伦教常教振兴路36号华普新翼广场二楼B09-1号铺',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'cityname': '佛山市',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'photos': [],\n",
       "   'typecode': '050100',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': '202',\n",
       "   'adname': '顺德区',\n",
       "   'name': '圣捞海鲜肥牛自助火锅(伦教店)',\n",
       "   'location': '113.211911,22.876124',\n",
       "   'tel': '0757-27758707',\n",
       "   'shopid': [],\n",
       "   'id': 'B0FFJKG5JI'},\n",
       "  {'parent': [],\n",
       "   'address': '大塘镇东风街25号西边(北江堤边)',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'cityname': '佛山市',\n",
       "   'type': '餐饮服务;中餐厅;海鲜酒楼',\n",
       "   'photos': [],\n",
       "   'typecode': '050119',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '三水区',\n",
       "   'name': '肥先生河鲜美食',\n",
       "   'location': '112.891499,23.441380',\n",
       "   'tel': '0757-87293860;13928596138',\n",
       "   'shopid': [],\n",
       "   'id': 'B02F50VWWG'},\n",
       "  {'parent': [],\n",
       "   'address': '大良永乐巷11号',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'cityname': '佛山市',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'photos': [],\n",
       "   'typecode': '050100',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '顺德区',\n",
       "   'name': '了能私房菜',\n",
       "   'location': '113.260834,22.823213',\n",
       "   'tel': '0757-22610717;18924806717',\n",
       "   'shopid': [],\n",
       "   'id': 'B02F503NOC'},\n",
       "  {'parent': 'B02F507S7M',\n",
       "   'address': '陈村旧墟南路名华楼1号(近农商银行)',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'cityname': '佛山市',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'photos': [],\n",
       "   'typecode': '050100',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': '202',\n",
       "   'adname': '顺德区',\n",
       "   'name': '陈村粉食府',\n",
       "   'location': '113.230000,22.960188',\n",
       "   'tel': '0757-23330218;0757-23355049',\n",
       "   'shopid': [],\n",
       "   'id': 'B02F507SF4'},\n",
       "  {'parent': 'B0FFGAVZNX',\n",
       "   'address': '西南街道张边路9号三水广场2期1层1698号',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'cityname': '佛山市',\n",
       "   'type': '餐饮服务;中餐厅;特色/地方风味餐厅',\n",
       "   'photos': [],\n",
       "   'typecode': '050118',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': '202',\n",
       "   'adname': '三水区',\n",
       "   'name': '探鱼(佛山三水广场店)',\n",
       "   'location': '112.891155,23.171947',\n",
       "   'tel': '0757-87789666',\n",
       "   'shopid': [],\n",
       "   'id': 'B0FFGHGPCN'},\n",
       "  {'parent': 'B02F5076LL',\n",
       "   'address': '大良锦龙路88号',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'cityname': '佛山市',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'photos': [],\n",
       "   'typecode': '050100',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': '302',\n",
       "   'adname': '顺德区',\n",
       "   'name': '凤厨',\n",
       "   'location': '113.246563,22.843232',\n",
       "   'tel': '0757-22219595',\n",
       "   'shopid': [],\n",
       "   'id': 'B02F507P17'},\n",
       "  {'parent': 'B02F503B8H',\n",
       "   'address': '云东海街道鸳鸯路2号',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'cityname': '佛山市',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'photos': [],\n",
       "   'typecode': '050100',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': '3',\n",
       "   'adname': '三水区',\n",
       "   'name': '今曰城大酒楼',\n",
       "   'location': '112.867957,23.183562',\n",
       "   'tel': '0757-87822888;13928583088',\n",
       "   'shopid': [],\n",
       "   'id': 'B02F503KRX'},\n",
       "  {'parent': [],\n",
       "   'address': '大沥镇大沥汽车站对面',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'cityname': '佛山市',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'photos': [],\n",
       "   'typecode': '050100',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '南海区',\n",
       "   'name': '鸿福山庄(敦和大道)',\n",
       "   'location': '113.105718,23.123735',\n",
       "   'tel': '0757-85568828',\n",
       "   'shopid': [],\n",
       "   'id': 'B02F507RKC'},\n",
       "  {'parent': [],\n",
       "   'address': '荷城街道西岸桥直入80米',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'cityname': '佛山市',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'photos': [],\n",
       "   'typecode': '050100',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '南海区',\n",
       "   'name': '捉蜂队农庄',\n",
       "   'location': '112.881702,22.875141',\n",
       "   'tel': '13078153898;13202807428',\n",
       "   'shopid': [],\n",
       "   'id': 'B02F50UXI4'},\n",
       "  {'parent': [],\n",
       "   'address': '广海大道西6号',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'cityname': '佛山市',\n",
       "   'type': '餐饮服务;中餐厅;综合酒楼',\n",
       "   'photos': [],\n",
       "   'typecode': '050101',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '三水区',\n",
       "   'name': '贡福楼',\n",
       "   'location': '112.883704,23.169134',\n",
       "   'tel': '0757-87817288;0757-87817388',\n",
       "   'shopid': [],\n",
       "   'id': 'B02F507RA3'},\n",
       "  {'parent': [],\n",
       "   'address': '南庄镇紫南南北大道西8号(近紫南美食城)',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'cityname': '佛山市',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'photos': [],\n",
       "   'typecode': '050100',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '禅城区',\n",
       "   'name': '桃园一品',\n",
       "   'location': '113.000812,23.005484',\n",
       "   'tel': '0757-82563888',\n",
       "   'shopid': [],\n",
       "   'id': 'B02F50W9RV'},\n",
       "  {'parent': [],\n",
       "   'address': '桂城怡海路壹品广场3号楼(桂城东侧)',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'cityname': '佛山市',\n",
       "   'type': '餐饮服务;中餐厅;综合酒楼',\n",
       "   'photos': [],\n",
       "   'typecode': '050101',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '南海区',\n",
       "   'name': '年年顺景酒楼(壹品广场桂城分店)',\n",
       "   'location': '113.157121,23.023134',\n",
       "   'tel': '0757-81066681;18666579662',\n",
       "   'shopid': [],\n",
       "   'id': 'B02F50ZYUX'},\n",
       "  {'parent': [],\n",
       "   'address': '西南园林路33号',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'cityname': '佛山市',\n",
       "   'type': '餐饮服务;中餐厅;综合酒楼',\n",
       "   'photos': [],\n",
       "   'typecode': '050101',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '三水区',\n",
       "   'name': '咏泉酒家',\n",
       "   'location': '112.891508,23.166626',\n",
       "   'tel': '0757-87728723',\n",
       "   'shopid': [],\n",
       "   'id': 'B02F50782N'},\n",
       "  {'parent': [],\n",
       "   'address': '南丰大道1号',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'cityname': '佛山市',\n",
       "   'type': '餐饮服务;中餐厅;综合酒楼',\n",
       "   'photos': [],\n",
       "   'typecode': '050101',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '三水区',\n",
       "   'name': '明昌酒楼(德兴北路)',\n",
       "   'location': '112.902456,23.173425',\n",
       "   'tel': '0757-87708818',\n",
       "   'shopid': [],\n",
       "   'id': 'B02F503P78'},\n",
       "  {'parent': [],\n",
       "   'address': '泰和路百合苑01',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'cityname': '佛山市',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'photos': [],\n",
       "   'typecode': '050100',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '高明区',\n",
       "   'name': '乡里外婆菜馆',\n",
       "   'location': '112.884778,22.884669',\n",
       "   'tel': '0757-88228620',\n",
       "   'shopid': [],\n",
       "   'id': 'B02F507SWE'},\n",
       "  {'parent': [],\n",
       "   'address': '丹灶镇桂丹西路22号',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'cityname': '佛山市',\n",
       "   'type': '餐饮服务;中餐厅;综合酒楼',\n",
       "   'photos': [],\n",
       "   'typecode': '050101',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '南海区',\n",
       "   'name': '竹溪酒家(桂丹路店)',\n",
       "   'location': '112.945039,23.059705',\n",
       "   'tel': '0757-85444633;0757-85444733',\n",
       "   'shopid': [],\n",
       "   'id': 'B02F507PIE'},\n",
       "  {'parent': [],\n",
       "   'address': '北滘镇建设北路119号',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'cityname': '佛山市',\n",
       "   'type': '餐饮服务;茶艺馆;茶艺馆|餐饮服务;中餐厅;中餐厅',\n",
       "   'photos': [],\n",
       "   'typecode': '050600|050100',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '顺德区',\n",
       "   'name': '香茗阁(北滘店)',\n",
       "   'location': '113.211397,22.924874',\n",
       "   'tel': '0757-26668413',\n",
       "   'shopid': [],\n",
       "   'id': 'B02F50400B'},\n",
       "  {'parent': [],\n",
       "   'address': '新城裕和路',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'cityname': '佛山市',\n",
       "   'type': '餐饮服务;中餐厅;综合酒楼',\n",
       "   'photos': [],\n",
       "   'typecode': '050101',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '顺德区',\n",
       "   'name': '太子酒家',\n",
       "   'location': '113.109320,22.964807',\n",
       "   'tel': '0757-29838668',\n",
       "   'shopid': [],\n",
       "   'id': 'B02F50WAC6'}],\n",
       " 'status': '1',\n",
       " 'info': 'OK'}"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "佛山_keywords = poi_keywords(key,\"佛山美食\")\n",
    "佛山_keywords"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 周边搜索\n",
    "* 1、URL：https://restapi.amap.com/v3/place/around?parameters \n",
    "\n",
    "* 2、请求方式：requests.get()  \n",
    "\n",
    "* 3、请求参数（parameters）：\n",
    "> * ①.必选：key（高德API密钥）、location（中心点坐标**经纬度**）\n",
    "> * ②.可选：keywords（查询关键字：多个关键字用“|”分割）、types（查询POI类型）、city（查询城市：可选值：城市中文、中文全拼、citycode、adcode）、radius（查询半径：0 - 50000）、sortrule（排序规则：按距离排序 - distance、综合排序 - weight）、offset（每页记录数据：不超过25）、page（当前页数：最大翻页数为100）、extensions（返回结果控制：base / all）、sig（数字签名）、callback（回调函数）、output（返回数据格式类型：json）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 调用geo.py文件中的周边搜索 poi_around 和 geocode 地理编码模块\n",
    "from geo import poi_around,geocode"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "113.121416,23.021548\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'suggestion': {'keywords': [], 'cities': []},\n",
       " 'count': '865',\n",
       " 'infocode': '10000',\n",
       " 'pois': [{'parent': [],\n",
       "   'address': '南海黄岐嘉洲广场三楼幸运儿美容美甲韩式定妆',\n",
       "   'distance': '0',\n",
       "   'biz_ext': [],\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'type': '生活服务;美容美发店;美容美发店',\n",
       "   'photos': [],\n",
       "   'typecode': '071100',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'name': '嘉洲广场',\n",
       "   'location': '113.121416,23.021548',\n",
       "   'tel': '13702612910',\n",
       "   'shopid': [],\n",
       "   'id': 'B0G27NE646'},\n",
       "  {'parent': [],\n",
       "   'address': '厚源路与岭南大道北交叉口西北150米',\n",
       "   'distance': '0',\n",
       "   'biz_ext': [],\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'photos': [],\n",
       "   'typecode': '050100',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'name': '兰姐私房菜',\n",
       "   'location': '113.121416,23.021545',\n",
       "   'tel': '13630188807',\n",
       "   'shopid': [],\n",
       "   'id': 'B0FFF6PIJK'},\n",
       "  {'parent': [],\n",
       "   'address': '厚源路与岭南大道北交叉口西北150米',\n",
       "   'distance': '1',\n",
       "   'biz_ext': [],\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'type': '餐饮服务;中餐厅;特色/地方风味餐厅',\n",
       "   'photos': [],\n",
       "   'typecode': '050118',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'name': '恒铭烟酒茶商行',\n",
       "   'location': '113.121407,23.021562',\n",
       "   'tel': '0757-83074899',\n",
       "   'shopid': [],\n",
       "   'id': 'B0FFHR7HP9'},\n",
       "  {'parent': [],\n",
       "   'address': '105国道北滘(碧桂园正门对面)',\n",
       "   'distance': '20',\n",
       "   'biz_ext': [],\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'type': '餐饮服务;外国餐厅;西餐厅(综合风味)',\n",
       "   'photos': [],\n",
       "   'typecode': '050201',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'name': 'nicole意大利',\n",
       "   'location': '113.121320,23.021712',\n",
       "   'tel': [],\n",
       "   'shopid': [],\n",
       "   'id': 'B0FFHREJDT'},\n",
       "  {'parent': [],\n",
       "   'address': '仓江路中港广场2楼',\n",
       "   'distance': '21',\n",
       "   'biz_ext': [],\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'type': '餐饮服务;餐饮相关场所;餐饮相关',\n",
       "   'photos': [],\n",
       "   'typecode': '050000',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'name': 'CrepeCake千语千层',\n",
       "   'location': '113.121316,23.021721',\n",
       "   'tel': '15875043743',\n",
       "   'shopid': [],\n",
       "   'id': 'B0G2UL4789'},\n",
       "  {'parent': [],\n",
       "   'address': '西南街道文锋东路2号三水恒福广场143之一',\n",
       "   'distance': '21',\n",
       "   'biz_ext': [],\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'type': '餐饮服务;快餐厅;快餐厅',\n",
       "   'photos': [],\n",
       "   'typecode': '050300',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'name': '伍福清汤腩面',\n",
       "   'location': '113.121316,23.021721',\n",
       "   'tel': '18718363446',\n",
       "   'shopid': [],\n",
       "   'id': 'B0G2COCNZF'},\n",
       "  {'parent': [],\n",
       "   'address': '荷城街道文昌路83号兴业大厦首层',\n",
       "   'distance': '21',\n",
       "   'biz_ext': [],\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'type': '餐饮服务;餐饮相关场所;餐饮相关',\n",
       "   'photos': [],\n",
       "   'typecode': '050000',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'name': '好品德酒家',\n",
       "   'location': '113.121316,23.021721',\n",
       "   'tel': '15338311573',\n",
       "   'shopid': [],\n",
       "   'id': 'B0G27NCANW'},\n",
       "  {'parent': [],\n",
       "   'address': '荷城街道荷香路295号华盈广场B78、B79商铺(住所申报)',\n",
       "   'distance': '21',\n",
       "   'biz_ext': [],\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'type': '餐饮服务;外国餐厅;西餐厅(综合风味)',\n",
       "   'photos': [],\n",
       "   'typecode': '050201',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'name': '麦乐基',\n",
       "   'location': '113.121316,23.021721',\n",
       "   'tel': '13570125589',\n",
       "   'shopid': [],\n",
       "   'id': 'B0G274CJD0'},\n",
       "  {'parent': [],\n",
       "   'address': '沙龙路17号',\n",
       "   'distance': '21',\n",
       "   'biz_ext': [],\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'type': '生活服务;生活服务场所;生活服务场所',\n",
       "   'photos': [],\n",
       "   'typecode': '070000',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'name': '遇见庐家',\n",
       "   'location': '113.121316,23.021721',\n",
       "   'tel': '18575756007',\n",
       "   'shopid': [],\n",
       "   'id': 'B0G1L45MDW'},\n",
       "  {'parent': [],\n",
       "   'address': '同兴路10号9座54到55号',\n",
       "   'distance': '21',\n",
       "   'biz_ext': [],\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'type': '生活服务;生活服务场所;生活服务场所',\n",
       "   'photos': [],\n",
       "   'typecode': '070000',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'name': '一隆装饰',\n",
       "   'location': '113.121316,23.021721',\n",
       "   'tel': '0757-82000697',\n",
       "   'shopid': [],\n",
       "   'id': 'B0G12KIPGE'},\n",
       "  {'parent': [],\n",
       "   'address': '均安镇都市经典1030号',\n",
       "   'distance': '21',\n",
       "   'biz_ext': [],\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'type': '生活服务;洗浴推拿场所;洗浴推拿场所',\n",
       "   'photos': [],\n",
       "   'typecode': '071400',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'name': '惠闲轩沐足',\n",
       "   'location': '113.121316,23.021721',\n",
       "   'tel': [],\n",
       "   'shopid': [],\n",
       "   'id': 'B0G12KIPC5'},\n",
       "  {'parent': [],\n",
       "   'address': '容桂海尾社区居委会文海西路8号保利合园商铺78号',\n",
       "   'distance': '21',\n",
       "   'biz_ext': [],\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'type': '生活服务;美容美发店;美容美发店',\n",
       "   'photos': [],\n",
       "   'typecode': '071100',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'name': '青花瓷养生美容连锁(百合花园)',\n",
       "   'location': '113.121316,23.021721',\n",
       "   'tel': '0757-23277704',\n",
       "   'shopid': [],\n",
       "   'id': 'B0FFL7BHHY'},\n",
       "  {'parent': [],\n",
       "   'address': '荷城街道中山路千彩街彩平巷66号铺',\n",
       "   'distance': '21',\n",
       "   'biz_ext': [],\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'type': '餐饮服务;餐饮相关场所;餐饮相关',\n",
       "   'photos': [],\n",
       "   'typecode': '050000',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'name': '东晋亿余商行',\n",
       "   'location': '113.121316,23.021721',\n",
       "   'tel': [],\n",
       "   'shopid': [],\n",
       "   'id': 'B0FFL5LHD1'},\n",
       "  {'parent': [],\n",
       "   'address': '文锋西路',\n",
       "   'distance': '21',\n",
       "   'biz_ext': [],\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'type': '餐饮服务;餐饮相关场所;餐饮相关',\n",
       "   'photos': [],\n",
       "   'typecode': '050000',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'name': '乔荟joe bar',\n",
       "   'location': '113.121316,23.021721',\n",
       "   'tel': '15986655910',\n",
       "   'shopid': [],\n",
       "   'id': 'B0FFKW88P7'},\n",
       "  {'parent': [],\n",
       "   'address': '贤和路-贤兴一街',\n",
       "   'distance': '21',\n",
       "   'biz_ext': [],\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'type': '餐饮服务;餐饮相关场所;餐饮相关',\n",
       "   'photos': [],\n",
       "   'typecode': '050000',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'name': '此刻简餐厅',\n",
       "   'location': '113.121316,23.021721',\n",
       "   'tel': '13926075012',\n",
       "   'shopid': [],\n",
       "   'id': 'B0FFKVZ88Q'},\n",
       "  {'parent': [],\n",
       "   'address': '九江镇龙高路烟南路口烟南综合楼首层A115号',\n",
       "   'distance': '21',\n",
       "   'biz_ext': [],\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'type': '餐饮服务;甜品店;甜品店',\n",
       "   'photos': [],\n",
       "   'typecode': '050900',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'name': '悦怡甜品店',\n",
       "   'location': '113.121316,23.021721',\n",
       "   'tel': '13928532453',\n",
       "   'shopid': [],\n",
       "   'id': 'B0FFKVY7JR'},\n",
       "  {'parent': [],\n",
       "   'address': '荷城街道民安市场',\n",
       "   'distance': '21',\n",
       "   'biz_ext': [],\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'type': '餐饮服务;餐饮相关场所;餐饮相关',\n",
       "   'photos': [],\n",
       "   'typecode': '050000',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'name': '飞牛便利',\n",
       "   'location': '113.121316,23.021721',\n",
       "   'tel': '13542540550',\n",
       "   'shopid': [],\n",
       "   'id': 'B0FFKV5GNB'},\n",
       "  {'parent': [],\n",
       "   'address': '华兴路15号中座',\n",
       "   'distance': '21',\n",
       "   'biz_ext': [],\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'type': '餐饮服务;餐饮相关场所;餐饮相关',\n",
       "   'photos': [],\n",
       "   'typecode': '050000',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'name': '金爪皇海兴小食店',\n",
       "   'location': '113.121316,23.021721',\n",
       "   'tel': '13709602194',\n",
       "   'shopid': [],\n",
       "   'id': 'B0FFKUO6PM'},\n",
       "  {'parent': [],\n",
       "   'address': '兴达路',\n",
       "   'distance': '21',\n",
       "   'biz_ext': [],\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'type': '餐饮服务;餐饮相关场所;餐饮相关',\n",
       "   'photos': [],\n",
       "   'typecode': '050000',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'name': '豆小厨豆浆',\n",
       "   'location': '113.121316,23.021721',\n",
       "   'tel': '13929800949',\n",
       "   'shopid': [],\n",
       "   'id': 'B0FFKTQR35'},\n",
       "  {'parent': [],\n",
       "   'address': '西青大道鸿安花园2座120铺',\n",
       "   'distance': '21',\n",
       "   'biz_ext': [],\n",
       "   'importance': [],\n",
       "   'biz_type': 'diner',\n",
       "   'type': '餐饮服务;餐饮相关场所;餐饮相关',\n",
       "   'photos': [],\n",
       "   'typecode': '050000',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'name': '烘味哗',\n",
       "   'location': '113.121316,23.021721',\n",
       "   'tel': '13724606442',\n",
       "   'shopid': [],\n",
       "   'id': 'B0FFKTDRMX'}],\n",
       " 'status': '1',\n",
       " 'info': 'OK'}"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 调用地理编码的函数获取佛山的地理编码\n",
    "佛山_geo = geocode(key,\"佛山\")\n",
    "佛山_geo['geocodes'][0]['location']\n",
    "print(佛山_geo['geocodes'][0]['location'])\n",
    "\n",
    "# 调用周边搜索的函数\n",
    "佛山_周边 = poi_around(key,佛山_geo['geocodes'][0]['location'])\n",
    "佛山_周边"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 多边形搜索\n",
    "* 1、URL：https://restapi.amap.com/v3/place/polygon?parameters  \n",
    "\n",
    "* 2、请求方式：requests.get()  \n",
    "\n",
    "* 3、请求参数（parameters）：\n",
    "> * ①.必选：key（高德API密钥）、polygon（经纬度坐标对：经度和纬度用\",\"分割，经度在前，纬度在后，坐标对用\"|\"分割）\n",
    "> * ②.可选：keywords（查询关键字：多个关键字用“|”分割）、types（查询POI类型）、offset（每页记录数据：不超过25）、page（当前页数：最大翻页数为100）、extensions（返回结果控制：base / all）、sig（数字签名）、callback（回调函数）、output（返回数据格式类型：json）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 调用geo.py文件中的多边形搜索 poi_polygon 和 geocode 地理编码模块\n",
    "from geo import poi_polygon,geocode"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "113.121416,23.021548\n",
      "113.264434,23.129162\n",
      "114.057868,22.543099\n",
      "113.576726,22.270715\n"
     ]
    }
   ],
   "source": [
    "# 调用地理编码的函数获取佛山的地理编码\n",
    "佛山_geo = geocode(key,\"佛山\")\n",
    "佛山_geo['geocodes'][0]['location']\n",
    "print(佛山_geo['geocodes'][0]['location'])\n",
    "\n",
    "# 调用地理编码的函数获取广州的地理编码\n",
    "广州_geo = geocode(key,\"广州\")\n",
    "广州_geo['geocodes'][0]['location']\n",
    "print(广州_geo['geocodes'][0]['location'])\n",
    "\n",
    "# 调用地理编码的函数获取深圳的地理编码\n",
    "深圳_geo = geocode(key,\"深圳\")\n",
    "深圳_geo['geocodes'][0]['location']\n",
    "print(深圳_geo['geocodes'][0]['location'])\n",
    "\n",
    "# 调用地理编码的函数获取珠海的地理编码\n",
    "珠海_geo = geocode(key,\"珠海\")\n",
    "珠海_geo['geocodes'][0]['location']\n",
    "print(珠海_geo['geocodes'][0]['location'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'suggestion': {'keywords': [], 'cities': []},\n",
       " 'count': '900',\n",
       " 'infocode': '10000',\n",
       " 'pois': [{'parent': [],\n",
       "   'address': '南站北路',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'cityname': '广州市',\n",
       "   'type': '交通设施服务;火车站;火车站',\n",
       "   'photos': [],\n",
       "   'typecode': '150200',\n",
       "   'shopinfo': '2',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '番禺区',\n",
       "   'name': '广州南站',\n",
       "   'location': '113.269114,22.988374',\n",
       "   'tel': [],\n",
       "   'shopid': [],\n",
       "   'id': 'B00140VAP3'},\n",
       "  {'parent': [],\n",
       "   'address': '学府路与月亮湾大道交汇处',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'cityname': '深圳市',\n",
       "   'type': '交通设施服务;火车站;火车站',\n",
       "   'photos': [],\n",
       "   'typecode': '150200',\n",
       "   'shopinfo': '2',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '南山区',\n",
       "   'name': '深圳西站',\n",
       "   'location': '113.907276,22.527291',\n",
       "   'tel': '0755-61380053',\n",
       "   'shopid': [],\n",
       "   'id': 'B02F302519'},\n",
       "  {'parent': [],\n",
       "   'address': '南国中路57号',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'cityname': '佛山市',\n",
       "   'type': '交通设施服务;长途汽车站;长途汽车站',\n",
       "   'photos': [],\n",
       "   'typecode': '150400',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '顺德区',\n",
       "   'name': '顺德汽车客运总站',\n",
       "   'location': '113.25159,22.818436',\n",
       "   'tel': '0757-22339614;0757-22339637;18098188390',\n",
       "   'shopid': [],\n",
       "   'id': 'B02F50744Y'},\n",
       "  {'parent': [],\n",
       "   'address': '花地大道中51号(近地铁坑口站)',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'cityname': '广州市',\n",
       "   'type': '交通设施服务;长途汽车站;长途汽车站',\n",
       "   'photos': [],\n",
       "   'typecode': '150400',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '荔湾区',\n",
       "   'name': '芳村汽车客运站',\n",
       "   'location': '113.234984,23.079895',\n",
       "   'tel': '020-81405555',\n",
       "   'shopid': [],\n",
       "   'id': 'B00140MVTW'},\n",
       "  {'parent': [],\n",
       "   'address': '英东大道附近',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'cityname': '广州市',\n",
       "   'type': '交通设施服务;长途汽车站;长途汽车站',\n",
       "   'photos': [],\n",
       "   'typecode': '150400',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '南沙区',\n",
       "   'name': '南沙客运站(英东大道)',\n",
       "   'location': '113.595148,22.76919',\n",
       "   'tel': '020-34684785;020-39091251',\n",
       "   'shopid': [],\n",
       "   'id': 'B00140UEKE'},\n",
       "  {'parent': [],\n",
       "   'address': '南洲路182号',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'cityname': '广州市',\n",
       "   'type': '交通设施服务;长途汽车站;长途汽车站',\n",
       "   'photos': [],\n",
       "   'typecode': '150400',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '海珠区',\n",
       "   'name': '海珠客运站',\n",
       "   'location': '113.299392,23.063172',\n",
       "   'tel': '020-84013301;020-84013330',\n",
       "   'shopid': [],\n",
       "   'id': 'B00140MX67'},\n",
       "  {'parent': [],\n",
       "   'address': '福荫路',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'cityname': '广州市',\n",
       "   'type': '商务住宅;住宅区;住宅小区',\n",
       "   'photos': [],\n",
       "   'typecode': '120302',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '番禺区',\n",
       "   'name': '祈福新村',\n",
       "   'location': '113.331936,22.963228',\n",
       "   'tel': [],\n",
       "   'shopid': [],\n",
       "   'id': 'B00140UKAM'},\n",
       "  {'parent': [],\n",
       "   'address': '4号线',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'cityname': '广州市',\n",
       "   'type': '交通设施服务;地铁站;地铁站',\n",
       "   'photos': [],\n",
       "   'typecode': '150500',\n",
       "   'shopinfo': '2',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '南沙区',\n",
       "   'name': '金洲(地铁站)',\n",
       "   'location': '113.538886,22.792178',\n",
       "   'tel': [],\n",
       "   'shopid': [],\n",
       "   'id': 'BV10015821'},\n",
       "  {'parent': [],\n",
       "   'address': '(在建)22号线;(在建)2号线一期;(在建)7号线西延顺德段;2号线;7号线',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'cityname': '广州市',\n",
       "   'type': '交通设施服务;地铁站;地铁站',\n",
       "   'photos': [],\n",
       "   'typecode': '150500',\n",
       "   'shopinfo': '2',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '番禺区',\n",
       "   'name': '广州南站(地铁站)',\n",
       "   'location': '113.269125,22.988980',\n",
       "   'tel': [],\n",
       "   'shopid': [],\n",
       "   'id': 'BV10019725'},\n",
       "  {'parent': [],\n",
       "   'address': '钟村南站北路6号',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'cityname': '广州市',\n",
       "   'type': '交通设施服务;长途汽车站;长途汽车站',\n",
       "   'photos': [],\n",
       "   'typecode': '150400',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '番禺区',\n",
       "   'name': '广州南汽车客运站',\n",
       "   'location': '113.27153,22.99189',\n",
       "   'tel': '020-39267222;020-39267219',\n",
       "   'shopid': [],\n",
       "   'id': 'B00141IECL'},\n",
       "  {'parent': [],\n",
       "   'address': '海运路1号',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'cityname': '深圳市',\n",
       "   'type': '交通设施服务;港口码头;客运港',\n",
       "   'photos': [],\n",
       "   'typecode': '150301',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '南山区',\n",
       "   'name': '蛇口邮轮中心',\n",
       "   'location': '113.913411,22.468615',\n",
       "   'tel': [],\n",
       "   'shopid': [],\n",
       "   'id': 'B0FFGT31RY'},\n",
       "  {'parent': [],\n",
       "   'address': '8号线;广佛线',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'cityname': '广州市',\n",
       "   'type': '交通设施服务;地铁站;地铁站',\n",
       "   'photos': [],\n",
       "   'typecode': '150500',\n",
       "   'shopinfo': '2',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '海珠区',\n",
       "   'name': '沙园(地铁站)',\n",
       "   'location': '113.260584,23.088625',\n",
       "   'tel': [],\n",
       "   'shopid': [],\n",
       "   'id': 'BV10018365'},\n",
       "  {'parent': [],\n",
       "   'address': '1号线;6号线',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'cityname': '广州市',\n",
       "   'type': '交通设施服务;地铁站;地铁站',\n",
       "   'photos': [],\n",
       "   'typecode': '150500',\n",
       "   'shopinfo': '2',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '荔湾区',\n",
       "   'name': '黄沙(地铁站)',\n",
       "   'location': '113.239856,23.110524',\n",
       "   'tel': [],\n",
       "   'shopid': [],\n",
       "   'id': 'BV10015729'},\n",
       "  {'parent': [],\n",
       "   'address': '庆沙路88',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'cityname': '广州市',\n",
       "   'type': '交通设施服务;火车站;火车站',\n",
       "   'photos': [],\n",
       "   'typecode': '150200',\n",
       "   'shopinfo': '2',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '南沙区',\n",
       "   'name': '庆盛站',\n",
       "   'location': '113.491531,22.866987',\n",
       "   'tel': [],\n",
       "   'shopid': [],\n",
       "   'id': 'B00141J3XU'},\n",
       "  {'parent': [],\n",
       "   'address': '商贸大道南二路2号',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'cityname': '广州市',\n",
       "   'type': '交通设施服务;港口码头;客运港',\n",
       "   'photos': [],\n",
       "   'typecode': '150301',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '南沙区',\n",
       "   'name': '南沙客运港',\n",
       "   'location': '113.611843,22.770044',\n",
       "   'tel': '020-84688716;020-84688963',\n",
       "   'shopid': [],\n",
       "   'id': 'B00140UFX5'},\n",
       "  {'parent': 'B0FFG9IQV3',\n",
       "   'address': '广州大道南249号',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'cityname': '广州市',\n",
       "   'type': '商务住宅;住宅区;住宅小区',\n",
       "   'photos': [],\n",
       "   'typecode': '120302',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': '202',\n",
       "   'adname': '海珠区',\n",
       "   'name': '合生广场',\n",
       "   'location': '113.313833,23.08512',\n",
       "   'tel': '020-89621615;020-34329590;020-62381888',\n",
       "   'shopid': [],\n",
       "   'id': 'B00141JIFD'},\n",
       "  {'parent': [],\n",
       "   'address': '十三行路1号',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'cityname': '广州市',\n",
       "   'type': '商务住宅;楼宇;商务写字楼',\n",
       "   'photos': [],\n",
       "   'typecode': '120201',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '荔湾区',\n",
       "   'name': '新中国大厦',\n",
       "   'location': '113.253098,23.110603',\n",
       "   'tel': [],\n",
       "   'shopid': [],\n",
       "   'id': 'B00140W2CG'},\n",
       "  {'parent': [],\n",
       "   'address': '宝民一路171号',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'cityname': '深圳市',\n",
       "   'type': '交通设施服务;长途汽车站;长途汽车站',\n",
       "   'photos': [],\n",
       "   'typecode': '150400',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '宝安区',\n",
       "   'name': '宝安汽车站',\n",
       "   'location': '113.899168,22.563713',\n",
       "   'tel': [],\n",
       "   'shopid': [],\n",
       "   'id': 'B02F3025B8'},\n",
       "  {'parent': [],\n",
       "   'address': '南村镇金江大道中段',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'cityname': '广州市',\n",
       "   'type': '交通设施服务;交通服务相关;交通服务相关',\n",
       "   'photos': [],\n",
       "   'typecode': '150000',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '番禺区',\n",
       "   'name': '南村车站',\n",
       "   'location': '113.38521,23.007565',\n",
       "   'tel': [],\n",
       "   'shopid': [],\n",
       "   'id': 'B001409517'},\n",
       "  {'parent': [],\n",
       "   'address': '广深路西乡段105号',\n",
       "   'distance': [],\n",
       "   'biz_ext': [],\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_type': [],\n",
       "   'cityname': '深圳市',\n",
       "   'type': '交通设施服务;长途汽车站;长途汽车站',\n",
       "   'photos': [],\n",
       "   'typecode': '150400',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '宝安区',\n",
       "   'name': '西乡汽车站',\n",
       "   'location': '113.882773,22.577403',\n",
       "   'tel': '0755-27956763',\n",
       "   'shopid': [],\n",
       "   'id': 'B02F302901'}],\n",
       " 'status': '1',\n",
       " 'info': 'OK'}"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 调用多边形搜索的函数\n",
    "广佛深珠_ = poi_polygon(key,\"113.121416,23.021548|113.264434,23.129162|114.057868,22.543099|113.576726,22.270715\")\n",
    "广佛深珠_"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### ID查询\n",
    "* 1、URL：https://restapi.amap.com/v3/place/detail?parameters \n",
    "\n",
    "* 2、请求方式：requests.get()  \n",
    "\n",
    "* 3、请求参数（parameters）：\n",
    "> * ①.必选：key（高德API密钥）、id（兴趣点ID）\n",
    "> * ②.可选：sig（数字签名）、callback（回调函数）、output（返回数据格式类型：json）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 调用geo.py文件中的ID查询 poi_id 模块\n",
    "from geo import poi_id"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'count': '1',\n",
       " 'infocode': '10000',\n",
       " 'pois': [{'parent': [],\n",
       "   'distance': [],\n",
       "   'pcode': '110000',\n",
       "   'importance': [],\n",
       "   'biz_ext': {'cost': [], 'rating': []},\n",
       "   'recommend': '0',\n",
       "   'type': '商务住宅;楼宇;商务写字楼',\n",
       "   'photos': [{'title': '效果图',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/a9836f620749c34742cf1ab67dc98f08'},\n",
       "    {'title': [],\n",
       "     'url': 'http://store.is.autonavi.com/showpic/53b11166a310a21470acde3a'},\n",
       "    {'title': [],\n",
       "     'url': 'http://store.is.autonavi.com/showpic/53b11166a310a21470acde31'}],\n",
       "   'discount_num': '0',\n",
       "   'gridcode': '5916739702',\n",
       "   'typecode': '120201',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'deep_info': {'deepsrc': []},\n",
       "   'citycode': '010',\n",
       "   'adname': '朝阳区',\n",
       "   'indoor_src': '高德地图',\n",
       "   'children': [],\n",
       "   'tel': [],\n",
       "   'id': 'B0FFFAB6J2',\n",
       "   'tag': [],\n",
       "   'event': [],\n",
       "   'entr_location': '116.473993,39.992784',\n",
       "   'indoor_map': '1',\n",
       "   'email': [],\n",
       "   'timestamp': '2020-11-14 16:53:59',\n",
       "   'website': [],\n",
       "   'address': '阜荣街10号',\n",
       "   'adcode': '110105',\n",
       "   'pname': '北京市',\n",
       "   'biz_type': [],\n",
       "   'cityname': '北京市',\n",
       "   'postcode': [],\n",
       "   'match': '0',\n",
       "   'business_area': '望京',\n",
       "   'indoor_data': {'cmsid': 'TY000191_B0FFFAB6J2',\n",
       "    'truefloor': [],\n",
       "    'cpid': 'B0FFFAB6J2',\n",
       "    'floor': []},\n",
       "   'childtype': [],\n",
       "   'rich_content': [],\n",
       "   'exit_location': [],\n",
       "   'name': '首开广场',\n",
       "   'location': '116.473004,39.993306',\n",
       "   'shopid': [],\n",
       "   'navi_poiid': 'J50F001020_342662',\n",
       "   'groupbuy_num': '0'}],\n",
       " 'status': '1',\n",
       " 'info': 'OK'}"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 调用ID查询的函数\n",
    "ID_ = poi_id(key,\"B0FFFAB6J2\")\n",
    "ID_"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## IP定位\n",
    "* 1、根据用户输入的IP地址，能够快速的帮用户定位IP的所在位置。\n",
    "\n",
    "* 2、URL：https://restapi.amap.com/v3/ip?parameters \n",
    "\n",
    "* 3、请求方式：requests.get()  \n",
    "\n",
    "* 4、请求参数（parameters）：\n",
    "> * ①.必选：key（高德API密钥）\n",
    "> * ②.可选：ip（ip地址）、sig（数字签名）、output（返回数据格式类型：json）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 调用IP定位 ip 模块\n",
    "from geo import ip"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'province': '广东省',\n",
       " 'city': '广州市',\n",
       " 'adcode': '440100',\n",
       " 'rectangle': '113.1017375,22.93212254;113.6770499,23.3809537'}"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 调用ip定位的函数\n",
    "IP_ = ip(key,\"61.242.54.125\")\n",
    "IP_"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 静态地图\n",
    "* 1、通过返回一张地图图片响应HTTP请求，使用户能够将高德地图以图片形式嵌入自己的网页中。用户可以指定请求的地图位置、图片大小、以及在地图上添加覆盖物，如标签、标注、折线、多边形。\n",
    "\n",
    "* 2、URL：https://restapi.amap.com/v3/staticmap?parameters \n",
    "\n",
    "* 3、请求方式：requests.get()  \n",
    "\n",
    "* 4、请求参数（parameters）：\n",
    "> * ①.必选：key（高德API密钥）、location（地图中心点**经纬度**）、zoom（地图级别）\n",
    "> * ②.可选：size（地图大小：最大值为1024*1024）、scale（普通 1 /高清 2 ）、markers（标注）、labels（标签）、paths（折线）、traffic（交通路况标识：底图是否展现实时路况 可选值： 0，不展现；1，展现）、sig（数字签名）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 调用geo.py文件中的静态地图 staticmap 和 geocode 地理编码模块\n",
    "from geo import staticmap,geocode"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "113.121416,23.021548\n"
     ]
    }
   ],
   "source": [
    "# 调用地理编码的函数获取佛山的地理编码\n",
    "佛山_geo = geocode(key,\"佛山\")\n",
    "佛山_geo['geocodes'][0]['location']\n",
    "print(佛山_geo['geocodes'][0]['location'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'https://restapi.amap.com/v3/staticmap?parameters&key=54ff0cd3dfc0209e54bb7b5aec47605b&location=113.121416%2C23.021548&zoom=15&size=400%2A400&scale=1&traffic=0'"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 调用静态地图函数\n",
    "map_ = staticmap(key,\"113.121416,23.021548\")\n",
    "map_"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![静态地图](https://gitee.com/yangguojuan/gaud-api/raw/master/pictures/%E9%AB%98%E5%BE%B7API_%E9%9D%99%E6%80%81%E5%9C%B0%E5%9B%BE.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 坐标转换\n",
    "* 1、能够将用户输入的非高德坐标（GPS坐标、mapbar坐标、baidu坐标）转换成高德坐标。\n",
    "\n",
    "* 2、URL：https://restapi.amap.com/v3/assistant/coordinate/convert?parameters \n",
    "\n",
    "* 3、请求方式：requests.get()  \n",
    "\n",
    "* 4、请求参数（parameters）：\n",
    "> * ①.必选：key（高德API密钥）、location（坐标点：经度和纬度用\",\"分割，经度在前，纬度在后，经纬度小数点后不得超过6位。多个坐标对之间用”|”进行分隔）\n",
    "> * ②.可选：coordsys（原坐标系：可选值 gps、mapbar、baidu、autonavi <不进行转换>）、sig（数字签名）、output（返回数据格式类型：json）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 调用geo.py文件中的坐标转换 convert 和 geocode 地理编码模块\n",
    "from geo import convert,geocode"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "113.121416,23.021548\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'ok',\n",
       " 'infocode': '10000',\n",
       " 'locations': '113.121416,23.021548'}"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 调用地理编码的函数获取佛山的地理编码\n",
    "佛山_geo = geocode(key,\"佛山\")\n",
    "佛山_geo['geocodes'][0]['location']\n",
    "print(佛山_geo['geocodes'][0]['location'])\n",
    "\n",
    "# 调用坐标转换的函数\n",
    "佛山_坐标转换 = convert(key,佛山_geo['geocodes'][0]['location'])\n",
    "佛山_坐标转换"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 天气查询\n",
    "* 1、根据用户输入的adcode，查询目标区域当前/未来的天气情况。\n",
    "\n",
    "* 2、URL：https://restapi.amap.com/v3/weather/weatherInfo?parameters \n",
    "\n",
    "* 3、请求方式：requests.get()  \n",
    "\n",
    "* 4、请求参数（parameters）：\n",
    "> * ①.必选：key（高德API密钥）、city（城市编码 adcode）\n",
    "> * ②.可选：extensions（气象类型 base / all     base:返回实况天气     all:返回预报天气）、output（返回数据格式类型：json）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 调用geo.py文件中的天气查询 weather的模块\n",
    "from geo import weather"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'count': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'forecasts': [{'city': '从化区',\n",
       "   'adcode': '440117',\n",
       "   'province': '广东',\n",
       "   'reporttime': '2020-11-16 20:52:35',\n",
       "   'casts': [{'date': '2020-11-16',\n",
       "     'week': '1',\n",
       "     'dayweather': '晴',\n",
       "     'nightweather': '多云',\n",
       "     'daytemp': '28',\n",
       "     'nighttemp': '20',\n",
       "     'daywind': '西北',\n",
       "     'nightwind': '西北',\n",
       "     'daypower': '≤3',\n",
       "     'nightpower': '≤3'},\n",
       "    {'date': '2020-11-17',\n",
       "     'week': '2',\n",
       "     'dayweather': '多云',\n",
       "     'nightweather': '多云',\n",
       "     'daytemp': '28',\n",
       "     'nighttemp': '21',\n",
       "     'daywind': '东南',\n",
       "     'nightwind': '东南',\n",
       "     'daypower': '≤3',\n",
       "     'nightpower': '≤3'},\n",
       "    {'date': '2020-11-18',\n",
       "     'week': '3',\n",
       "     'dayweather': '多云',\n",
       "     'nightweather': '多云',\n",
       "     'daytemp': '27',\n",
       "     'nighttemp': '22',\n",
       "     'daywind': '南',\n",
       "     'nightwind': '南',\n",
       "     'daypower': '≤3',\n",
       "     'nightpower': '≤3'},\n",
       "    {'date': '2020-11-19',\n",
       "     'week': '4',\n",
       "     'dayweather': '多云',\n",
       "     'nightweather': '多云',\n",
       "     'daytemp': '28',\n",
       "     'nighttemp': '21',\n",
       "     'daywind': '东南',\n",
       "     'nightwind': '东南',\n",
       "     'daypower': '≤3',\n",
       "     'nightpower': '≤3'}]}]}"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 调用weather函数\n",
    "广州从化_天气 = weather(key,440117)\n",
    "广州从化_天气"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 输入提示\n",
    "* 1、提供根据用户输入的关键词查询返回建议列表。\n",
    "\n",
    "* 2、URL：https://restapi.amap.com/v3/assistant/inputtips?parameters \n",
    "\n",
    "* 3、请求方式：requests.get()  \n",
    "\n",
    "* 4、请求参数（parameters）：\n",
    "> * ①.必选：key（高德API密钥）、keywords（查询关键词）\n",
    "> * ②.可选：type（POI分类：POI分类名称、分类代码）、location（坐标：“X,Y”（经度,纬度） 不可以包含空格）、city（搜索城市：citycode、adcode，不支持县级市）、citylimit（仅返回指定城市数据：true / false）、datatype（返回的数据类型）、sig（数字签名）、output（返回数据格式类型：json）、callback（回调函数，**此参数只在output=JSON时有效**）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 调用geo.py文件中的输入提示 tips 模块\n",
    "from geo import tips"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'count': '10',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'tips': [{'id': 'B0FFIBH281',\n",
       "   'name': '麦当劳(新动力广场店)',\n",
       "   'district': '广东省佛山市三水区',\n",
       "   'adcode': '440607',\n",
       "   'location': '112.866804,23.172965',\n",
       "   'address': '西青大道8号新动力广场1层',\n",
       "   'typecode': '050302',\n",
       "   'city': []},\n",
       "  {'id': 'B0FFGKLR8R',\n",
       "   'name': '麦当劳(碧桂园三水华府店)',\n",
       "   'district': '广东省佛山市三水区',\n",
       "   'adcode': '440607',\n",
       "   'location': '112.881455,23.171445',\n",
       "   'address': '广海大道西29号',\n",
       "   'typecode': '050302',\n",
       "   'city': []},\n",
       "  {'id': 'B02F5051OM',\n",
       "   'name': '麦当劳(三水广场店)',\n",
       "   'district': '广东省佛山市三水区',\n",
       "   'adcode': '440607',\n",
       "   'location': '112.892858,23.172322',\n",
       "   'address': '张边路9号三水广场1座1层',\n",
       "   'typecode': '050302',\n",
       "   'city': []},\n",
       "  {'id': 'B0FFF5TWQ4',\n",
       "   'name': '麦当劳(三水西侨店)',\n",
       "   'district': '广东省佛山市三水区',\n",
       "   'adcode': '440607',\n",
       "   'location': '112.890000,23.156339',\n",
       "   'address': '文锋中路2号西侨商场2层',\n",
       "   'typecode': '050302',\n",
       "   'city': []},\n",
       "  {'id': 'B0FFGM6OMN',\n",
       "   'name': '麦当劳(丹灶丹横路店)',\n",
       "   'district': '广东省佛山市南海区',\n",
       "   'adcode': '440605',\n",
       "   'location': '112.905193,23.099245',\n",
       "   'address': '丹灶镇丹横路5号金爵士广场',\n",
       "   'typecode': '050302',\n",
       "   'city': []},\n",
       "  {'id': 'B02F506SYF',\n",
       "   'name': '麦当劳(佛山市高明时代广场店)',\n",
       "   'district': '广东省佛山市高明区',\n",
       "   'adcode': '440608',\n",
       "   'location': '112.885917,22.896210',\n",
       "   'address': '文昌路188号时代广场1层',\n",
       "   'typecode': '050302',\n",
       "   'city': []},\n",
       "  {'id': 'B0FFF6RH3V',\n",
       "   'name': '麦当劳(狮山博爱中路店)',\n",
       "   'district': '广东省佛山市南海区',\n",
       "   'adcode': '440605',\n",
       "   'location': '113.005060,23.121969',\n",
       "   'address': '狮山镇博爱中路61号和信商业广场首层1A001号商铺及二层2A002',\n",
       "   'typecode': '050302',\n",
       "   'city': []},\n",
       "  {'id': 'B0FFHLGYSF',\n",
       "   'name': '麦当劳(西樵金典广场店)',\n",
       "   'district': '广东省佛山市南海区',\n",
       "   'adcode': '440605',\n",
       "   'location': '112.986285,22.940391',\n",
       "   'address': '西樵登山大道边金典广场首层A1002-A1005、A1016-A1020',\n",
       "   'typecode': '050302',\n",
       "   'city': []},\n",
       "  {'id': 'B02F50WC7L',\n",
       "   'name': '麦当劳得来速(狮城路餐厅)',\n",
       "   'district': '广东省佛山市南海区',\n",
       "   'adcode': '440605',\n",
       "   'location': '113.010646,23.127322',\n",
       "   'address': '狮山镇狮城路丽怡路路口信富广场1层',\n",
       "   'typecode': '050302',\n",
       "   'city': []},\n",
       "  {'id': 'B0FFLCWVIK',\n",
       "   'name': '麦当劳(狮山科技大道店)',\n",
       "   'district': '广东省佛山市南海区',\n",
       "   'adcode': '440605',\n",
       "   'location': '113.031742,23.143754',\n",
       "   'address': '万锦路阳光在线广场',\n",
       "   'typecode': '050302',\n",
       "   'city': []}]}"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 调用输入提示函数\n",
    "输入提示_ = tips(key,\"佛山麦当劳\")\n",
    "输入提示_"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 交通态势\n",
    "* 1、提供根据用户输入的内容能够返回希望查询的交通态势情况。\n",
    "\n",
    "* 2、URL：（具体见下方） \n",
    "\n",
    "* 3、请求方式：requests.get()  \n",
    "\n",
    "* 4、请求参数（parameters）：\n",
    "> * ①.必选：（具体见下方）\n",
    "> * ②.可选：（具体见下方）\n",
    "\n",
    "* 5、（矩形区域交通态势、圆形区域交通态势、指定线路交通态势）"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 矩形区域交通态势\n",
    "\n",
    "* 1、URL：https://restapi.amap.com/v3/traffic/status/rectangle?parameters\n",
    "\n",
    "* 2、请求方式：requests.get()  \n",
    "\n",
    "* 3、请求参数（parameters）：\n",
    "> * ①.必选：key（高德API密钥）、rectangle（代表此为矩形区域查询）\n",
    "> * ②.可选：level（道路等级：1 2 3 4 5 6）、extensions（返回结果控制：base / all）、sig（数字签名）、output（返回数据格式类型：JSON / XML）、callback（回调函数，此参数只在**output=JSON**时有效）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 调用矩形区域交通态势 squareness 和 地理编码 geocode 模块\n",
    "from geo import squareness,geocode"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "113.121416,23.021548\n",
      "113.264434,23.129162\n",
      "114.057868,22.543099\n",
      "113.576726,22.270715\n"
     ]
    }
   ],
   "source": [
    "# 调用地理编码的函数获取佛山的地理编码\n",
    "佛山_geo = geocode(key,\"佛山\")\n",
    "佛山_geo['geocodes'][0]['location']\n",
    "print(佛山_geo['geocodes'][0]['location'])\n",
    "\n",
    "# 调用地理编码的函数获取广州的地理编码\n",
    "广州_geo = geocode(key,\"广州\")\n",
    "广州_geo['geocodes'][0]['location']\n",
    "print(广州_geo['geocodes'][0]['location'])\n",
    "\n",
    "# 调用地理编码的函数获取深圳的地理编码\n",
    "深圳_geo = geocode(key,\"深圳\")\n",
    "深圳_geo['geocodes'][0]['location']\n",
    "print(深圳_geo['geocodes'][0]['location'])\n",
    "\n",
    "# 调用地理编码的函数获取珠海的地理编码\n",
    "珠海_geo = geocode(key,\"珠海\")\n",
    "珠海_geo['geocodes'][0]['location']\n",
    "print(珠海_geo['geocodes'][0]['location'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'info': 'INSUFFICIENT_PRIVILEGES',\n",
       " 'infocode': '10012',\n",
       " 'status': '0',\n",
       " 'sec_code_debug': 'd41d8cd98f00b204e9800998ecf8427e',\n",
       " 'key': '54ff0cd3dfc0209e54bb7b5aec47605b',\n",
       " 'sec_code': 'd41d8cd98f00b204e9800998ecf8427e'}"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "矩形_交通态势 = squareness(key,\"113.121416,23.021548|113.264434,23.129162|114.057868,22.543099|113.576726,22.270715\")\n",
    "矩形_交通态势"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "权限不足，访问被拒绝， 原因：该功能接口计划将于2020年12月31日下线，目前不再对新用户开放。"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.6rc1"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "165px"
   },
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
